-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const assertions #7970
Comments
This would be really handy for objects as well. Some of our redux code at work defines constants objects like so:
except the constants are much longer. It would be nice to be able to do:
|
Thia is currently possible with Object.freeze, but only |
Does this mean |
@kevinbarabash, no, union |
something new here? this static type checker really has some potential but these missing typescript equivalent features prevent many of us from trying flow seriously... |
|
Proposal
https://devblogs.microsoft.com/typescript/announcing-typescript-3-4/#const-assertions
Use case
More explicit version of #7607
Also would eliminate need for
Object.freeze
as tool for casting to singleton stringsObject.freeze
is also a bit broken with regards to subtyping #7964Not sure how sound it is, given that it is type cast essentially
Alternative
The text was updated successfully, but these errors were encountered: