Skip to content

Incorrect error and crash for export as default #2451

Closed
@JsonFreeman

Description

@JsonFreeman
var x;
export { x as default };

This code should be legal, but I get "Identifier expected" on the default keyword. The grammar says that this can be an IdentifierName.

Also, this crashes the compiler:

                            if (specifier.name.text === "default") {
                                              ^
TypeError: Cannot read property 'text' of undefined
    at ts.forEach.exportDefault (built/local/tsc.js:22592:47)
    at Object.forEach (built/local/tsc.js:602:30)
    at _i (built/local/tsc.js:22591:28)
    at Object.forEach (built/local/tsc.js:602:30)
    at createExternalModuleInfo (built/local/tsc.js:22589:20)
    at emitAMDModule (built/local/tsc.js:22639:17)
    at emitSourceFileNode (built/local/tsc.js:22777:25)
    at emitJavaScriptWorker (built/local/tsc.js:22987:32)
    at emitNodeWithoutSourceMap (built/local/tsc.js:22804:17)
    at emitSourceFile (built/local/tsc.js:19555:17)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions