You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that this works in compiler built from recent sources:
export default A;
interface A {}
According to the ES6 specification, after "export default" we only have three options:
class declaration
hoistable declaration (i.e., function or generator declaration)
AssignmentExpression
If we treat "A" from my example as an AssignmentExpression, then it should work exactly the same way as AssignmentExpression in any other place, e.g. "var x = A".
For "var x = A" we reasonably have 'Cannot find name A'.
But in my example above, 'A' is resolved.
It means, that after 'export default' we have something different from an ordinary AssignmentExpression.
Are there some special rules for what can appear after export default in the statement?
Does it have a special meaning in case of "export default Identifier"?
Thanks!
The text was updated successfully, but these errors were encountered:
Note: there are some additional changes to how export default and export = work that is not in master now. see #2460 for more details.
In the current implementation export default Identifier indicates exporting all meanings of the Identifier (value, type and namespace), that is the same behavior in export = Identifier.
At compile time the compiler will elide exports that do not have a value, and in the given example, interface A, the export default statement, and any imports to the default binding in other modules will not be written to your .js output.
Thanks a lot, now it's clear for me, and I see that #2460 is merged into master, so I'll see and try the new changes. You may close this question, thanks.
I see that this works in compiler built from recent sources:
According to the ES6 specification, after "export default" we only have three options:
If we treat "A" from my example as an AssignmentExpression, then it should work exactly the same way as AssignmentExpression in any other place, e.g. "var x = A".
For "var x = A" we reasonably have 'Cannot find name A'.
But in my example above, 'A' is resolved.
It means, that after 'export default' we have something different from an ordinary AssignmentExpression.
Are there some special rules for what can appear after export default in the statement?
Does it have a special meaning in case of "export default Identifier"?
Thanks!
The text was updated successfully, but these errors were encountered: