We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Enums by themselves would be anonymous. Typedefs would be used to provide access to these. To access specific fields, use the :: symbol.
::
type PromiseState = enum { pending, fulfilled, errored } type Promise<T> = { state: PromiseState, value: T? } fn doSomethingAsync<T>(value: T): Promise<T> => { value, state: PromiseState::fulfilled }
The text was updated successfully, but these errors were encountered:
Could this be a more compact syntax:
enum PromiseStat { pending, fulfilled, errored }
Sorry, something went wrong.
That could definitely be doable, and wouldn’t be that hard to parse.
My only concern is consistency. Since all other types are declared with “type foo”, I think it would be smart to also declare enums in the same way.
Remaining:
No branches or pull requests
Enums by themselves would be anonymous. Typedefs would be used to provide access to these. To access specific fields, use the
::
symbol.The text was updated successfully, but these errors were encountered: