Skip to content

Commit 1360d1e

Browse files
committed
WIP: provide typing default for optional typevar
1 parent 2d72236 commit 1360d1e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

disnake/ui/button.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33
from __future__ import annotations
44

55
import os
6-
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Optional, Tuple, TypeVar, Union, overload
6+
from typing import (
7+
TYPE_CHECKING,
8+
Any,
9+
Callable,
10+
ClassVar,
11+
Optional,
12+
Tuple,
13+
TypeVar,
14+
Union,
15+
overload,
16+
)
717

818
from ..components import Button as ButtonComponent
919
from ..enums import ButtonStyle, ComponentType
@@ -17,18 +27,23 @@
1727
)
1828

1929
if TYPE_CHECKING:
20-
from typing_extensions import ParamSpec, Self
30+
from typing_extensions import (
31+
ParamSpec,
32+
Self,
33+
TypeVar, # noqa: TC004
34+
)
2135

2236
from ..emoji import Emoji
2337
from .item import ItemCallbackType
2438
from .view import View
2539

40+
V_co = TypeVar("V_co", bound="Optional[View]", covariant=True, default=None)
2641
else:
2742
ParamSpec = TypeVar
43+
V_co = TypeVar("V_co", bound="Optional[View]", covariant=True)
2844

2945
B = TypeVar("B", bound="Button")
3046
B_co = TypeVar("B_co", bound="Button", covariant=True)
31-
V_co = TypeVar("V_co", bound="Optional[View]", covariant=True)
3247
P = ParamSpec("P")
3348

3449

0 commit comments

Comments
 (0)