Skip to content

TypeError: Cannot read property 'length' of undefined at Object.forEachChild #18301

Closed
@lambda-fairy

Description

@lambda-fairy

TypeScript Version: 2.5.2 and 2.6.0-dev.20170906 (can reproduce on both versions)

Code

/**
 * @typedef LoadCallback
 * @type {function}
 */
type LoadCallback = void;

Expected behavior: Code compiles successfully.

Actual behavior:
Compiler crashes with the following error:

/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9921
                for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) {
                                                                     ^

TypeError: Cannot read property 'length' of undefined
    at Object.forEachChild (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9921:70)
    at setParentPointers (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:17392:12)
    at /tmp/chris/downloads/node_modules/typescript/lib/tsc.js:17392:64
    at visitNode (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9533:24)
    at Object.forEachChild (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9918:25)
    at setParentPointers (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:17392:12)
    at /tmp/chris/downloads/node_modules/typescript/lib/tsc.js:17392:64
    at visitNodes (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9542:30)
    at Object.forEachChild (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9891:24)
    at setParentPointers (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:17392:12)
    at bindChildrenWorker (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15178:25)
    at bindChildren (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15140:17)
    at bindContainer (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15122:17)
    at bind (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:16214:21)
    at bindEach (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15157:21)
    at visitNodes (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9538:24)
    at Object.forEachChild (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:9707:24)
    at bindEachChild (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15165:16)
    at bindChildrenWorker (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15254:21)
    at bindChildren (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15140:17)
    at bindContainer (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:15093:17)
    at bind (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:16214:21)
    at bindSourceFile (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:14851:17)
    at Object.bindSourceFile (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:14809:9)
    at initializeTypeChecker (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:36496:20)
    at Object.createTypeChecker (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:18543:9)
    at getDiagnosticsProducingTypeChecker (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:56042:93)
    at Object.getGlobalDiagnostics (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:56370:53)
    at compileProgram (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:59092:78)
    at compile (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:59051:26)
    at performCompilation (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:58940:33)
    at Object.executeCommandLine (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:58883:9)
    at Object.<anonymous> (/tmp/chris/downloads/node_modules/typescript/lib/tsc.js:59241:4)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/tmp/chris/downloads/node_modules/typescript/bin/tsc:2:1)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions