Skip to content

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

@andy-hanson

Description

@andy-hanson

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.

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