Skip to content

Crash in getRootDeclaration when both global namespace and export as namespace exist #28380

@ghost

Description

TypeScript Version: 3.2.0-dev.20181106

Code

declare global { namespace N {} }
export = N;
export as namespace N;

Expected behavior:

No crash.

Actual behavior:

TypeError: Cannot read property 'kind' of undefined
    at getRootDeclaration (typescript\lib\tsc.js:8182:21)
    at Object.isCatchClauseVariableDeclarationOrBindingElement (typescript\lib\tsc.js:6311:20)
    at getTypeOfVariableOrParameterOrPropertyWorker (typescript\lib\tsc.js:29148:20)
    at getTypeOfVariableOrParameterOrProperty (typescript\lib\tsc.js:29132:48)
    at getTypeOfSymbol (typescript\lib\tsc.js:29401:24)
    at checkIdentifier (typescript\lib\tsc.js:37975:49)
    at checkExpressionWorker (typescript\lib\tsc.js:42937:28)
    at checkExpression (typescript\lib\tsc.js:42913:42)
    at checkExpressionCached (typescript\lib\tsc.js:42796:38)
    at markAliasSymbolAsReferenced (typescript\lib\tsc.js:26588:21)

Discovered in business-rules-engine on DefinitelyTyped.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions