python (3.12.0)
1 from typing import TYPE_CHECKING, Optional
2
3 if TYPE_CHECKING:
4 # TypedDict was introduced in Python 3.8.
5 #
6 # TODO: Remove the else block and TYPE_CHECKING check when dropping support
7 # for Python 3.7.
8 from typing import TypedDict
9
10 class ESC[4;38;5;81mResultDict(ESC[4;38;5;149mTypedDict):
11 encoding: Optional[str]
12 confidence: float
13 language: Optional[str]
14
15 else:
16 ResultDict = dict