Skip to content

Question: top-level interface and ES6 "export default AssignmentExpression" #2490

Closed
@zhuravlikjb

Description

@zhuravlikjb

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:

  1. class declaration
  2. hoistable declaration (i.e., function or generator declaration)
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions