Conversation
Copy link
Copy Markdown
Member
Multiple changes:
- Style:
Nonemust be the last item in a union - Using
Finalfor constants. It changes the inferce:
Before:
» mypy ex.py
ex.py:3: note: Revealed type is "msgspec.UnsetType"
Success: no issues found in 1 source file
After:
» mypy ex.py
ex.py:3: note: Revealed type is "Literal[msgspec.UnsetType.UNSET]?"
Success: no issues found in 1 source file
- Using
TypeIsinstead ofTypeGuard, so we can better narrow in the negative case as well. This check is symmetric. - Renaming
T->_Tto remove type-checking name from possible imports. - Fixing
basestype, it can accept all types, not just structs