Skip to content

Add typing.(TypeAlias, NewType, Never, assert_never) for type checkers#357

Merged
blueloveTH merged 1 commit intopocketpy:mainfrom
hcarty:typing-types-and-exhaustiveness
Apr 7, 2025
Merged

Add typing.(TypeAlias, NewType, Never, assert_never) for type checkers#357
blueloveTH merged 1 commit intopocketpy:mainfrom
hcarty:typing-types-and-exhaustiveness

Conversation

@hcarty
Copy link
Contributor

@hcarty hcarty commented Apr 6, 2025

These additions are meant to help with static type checking. pocketpy has a lot of the typing module already! This PR adds a few more definitions I've found useful in my own projects.

  • TypeAlias, NewType for making type definitions explicit
  • Never for indicating that something can never return or be reached
  • assert_never for indicating that a code path is statically unreachable, usually in the context of an exhaustiveness check

@blueloveTH blueloveTH merged commit e045892 into pocketpy:main Apr 7, 2025
@blueloveTH
Copy link
Collaborator

Thanks for your contribution!

@hcarty hcarty deleted the typing-types-and-exhaustiveness branch April 7, 2025 13:10
@hcarty hcarty restored the typing-types-and-exhaustiveness branch April 7, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants