sobolevn · GitHub

Conversation

@sobolevn

Copy link Copy Markdown

Member

Multiple changes:

  1. Style: None must be the last item in a union
  2. Using Final for 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
  1. Using TypeIs instead of TypeGuard, so we can better narrow in the negative case as well. This check is symmetric.
  2. Renaming T -> _T to remove type-checking name from possible imports.
  3. Fixing bases type, it can accept all types, not just structs

@sobolevn

@sobolevn

provinzkraut

@sobolevn

@sobolevn

@sobolevn

@sobolevn

Labels

None yet

2 participants

@sobolevn @provinzkraut

Read the original on github.com ↗