Skip to content

F401 false positive with TypeAliasType and forward annotation #15812

@Viicos

Description

@Viicos

Description

search keywords: F401 Typealiastype

from typing import Union

from typing_extensions import TypeAliasType


Json = TypeAliasType(
    'Json',
    'Union[dict[str, Json], list[Json], str, int, float, bool, None]',
)
repro4.py:1:20: F401 [*] `typing.Union` imported but unused
  |
1 | from typing import Union
  |                    ^^^^^ F401
2 |
3 | from typing import TypeAliasType
  |
  = help: Remove unused import: `typing.Union`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions