Skip to content

Incorrect error and crash for export as default #2451

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

Closed
JsonFreeman opened this issue Mar 21, 2015 · 1 comment
Closed

Incorrect error and crash for export as default #2451

JsonFreeman opened this issue Mar 21, 2015 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@JsonFreeman
Copy link
Contributor

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)
@JsonFreeman JsonFreeman added the Bug A bug in TypeScript label Mar 21, 2015
@ahejlsberg ahejlsberg self-assigned this Mar 21, 2015
@ahejlsberg ahejlsberg added this to the TypeScript 1.5 milestone Mar 21, 2015
@ahejlsberg
Copy link
Member

Both of these issues are fixed in a PR I'm working on.

@mhegazy mhegazy closed this as completed Apr 1, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 1, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants