Skip to content

Crash when typedef references a jsdoc-style inner-class namepath #25104

@sandersn

Description

@sandersn

From discussion on a bug with related symptoms.

class C {
    /**
     * @typedef {C~A} C~B
     * @typedef {object} C~A
     */
    /** @param {C~A} o */
    constructor(o) {
    }
}

Expected behavior:
No crash, although o: any because we don't parse namepaths.

Actual behavior:

        return node.kind === 71 /* Identifier */;
                    ^

TypeError: Cannot read property 'kind' of undefined
    at Object.isIdentifier (/home/nathansa/ts/built/local/tsc.js:12193:21)
    at getDeclarationIdentifier (/home/nathansa/ts/built/local/tsc.js:11954:19)
    at nameForNamelessJSDocTypedef (/home/nathansa/ts/built/local/tsc.js:11916:20)
    at getNameOfJSDocTypedef (/home/nathansa/ts/built/local/tsc.js:11957:36)
    at Object.getNameOfDeclaration (/home/nathansa/ts/built/local/tsc.js:12002:24)
    at Object.hasDynamicName (/home/nathansa/ts/built/local/tsc.js:9844:23)
    at declareSymbol (/home/nathansa/ts/built/local/tsc.js:25659:33)
    at bindBlockScopedDeclaration (/home/nathansa/ts/built/local/tsc.js:26949:21)
    at delayedBindJSDocTypedefTag (/home/nathansa/ts/built/local/tsc.js:26974:21)
    at bindSourceFile (/home/nathansa/ts/built/local/tsc.js:25532:17)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions