NewType errors to help with using NewType #3511
rchiodo
started this conversation in
Enhancement
Replies: 1 comment
-
In your example above, you chose the name Typically, a more descriptive class name would be chosen by the user. For example: Width = NewType('Width', int)
x = Width(3)
reveal_type(x) # Width |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When using NewType, it would be nice to give better error messages and better representation:
NewTypes aren't referenced that way anywhere else. It would be cool if that said e: NewType[int]
When creating NewTypes, you can only pass the base object as a parameter. Error messages on incorrect usage could indicate this:
Beta Was this translation helpful? Give feedback.
All reactions