Skip to content

TypeError: Cannot read property 'declarations' of undefined #6428

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
andy-hanson opened this issue Jan 10, 2016 · 1 comment
Closed

TypeError: Cannot read property 'declarations' of undefined #6428

andy-hanson opened this issue Jan 10, 2016 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@andy-hanson
Copy link

The following code (in file Foo.ts) causes the compiler to crash:

import Foo From './Foo'
export default Foo

(Yes, that's a capitalized From and it tries to export itself.)

The error is:

TypeError: Cannot read property 'declarations' of undefined
    at /home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:13033:58
    at Object.forEach (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:98:30)
    at buildVisibleNodeList (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:13023:20)
    at Object.collectLinkedAliases (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:13019:17)
    at emitExportAssignment (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:24594:38)
    at emitNode (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:25513:28)
    at emitLines (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:24406:17)
    at emitSourceFile (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:24558:13)
    at /home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:24242:17
    at Object.forEach (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:98:30)

Tested on typescript 1.8.0-dev.20160109.

@vladima
Copy link
Contributor

vladima commented Jan 10, 2016

good catch, thanks!
repro without syntax errors (compile with -d)

// a.ts
import Foo = SomeNonExistingName
export {Foo}

@mhegazy mhegazy added the Bug A bug in TypeScript label Jan 11, 2016
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Jan 11, 2016
@mhegazy mhegazy self-assigned this Jan 11, 2016
mhegazy added a commit that referenced this issue Jan 15, 2016
mhegazy added a commit that referenced this issue Jan 15, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 15, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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