-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove runtime assignment of type aliases to
Any
. (#2378)
* fix: remove runtime assignment of type aliases to `Any`. This PR replaces this pattern: ```py from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from typing_extensions import TypeAlias from litestar import Thing ThingAlias: TypeAlias = Thing else: ThingAlias: TypeAlias = Any ``` My best guess is that this pattern was some workaround for circular dependencies before we introduced `__future__.annotations`. I believe these changes will be beneficial as: - the current pattern is non-standard (at least in my experience) - the current pattern causes the types to be documented as `Any` in the API docs. * Use modern generic types. * Refactor internal_types.py * Address review. De-stringizes type aliases where possible by importing components from typing at runtime.
- Loading branch information
1 parent
1dca41f
commit 82aeb3d
Showing
2 changed files
with
28 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters