-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Support export default const #18737
Comments
This is actually not currently supported by the ECMAScript specification. Currently, There was a fair amount of discussion about this a while ago on https://esdiscuss.org. I'll try to find the thread and link it. |
Hear is the thread, it dates to 2013 and covered the topic in depth. https://esdiscuss.org/topic/why-is-export-default-var-a-1-invalid-syntax |
We recommend taking these features to TC39 instead. |
What about enums? |
@TedDriggs , Please see #3792 (comment) |
For others having the same problem: You can just do it like that: export const a = 5;
export default a; The issue is that the syntax could be ambiguous, that's why anything link // nonsense
export default const a = 5, b = 5, c = 5; Read more here, as @aluanhaddad already pointed out: https://esdiscuss.org/topic/why-is-export-default-var-a-1-invalid-syntax |
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
2.6.0-dev.20170921
Code
Expected behavior:
Compile succ
Actual behavior:
Compile error
The text was updated successfully, but these errors were encountered: