Closed
Description
TypeScript Version: v3.7.0-dev.20191006
Search Terms: globalThis namespace crash
Code
namespace globalThis {
export function foo() { console.log('x'); }
}
Expected behavior:
Should either compile or give an error
Actual behavior:
Crash:
/tmp/xx/node_modules/typescript/lib/tsc.js:78471
throw e;
^
TypeError: Cannot read property 'length' of undefined
at checkModuleDeclaration (/tmp/xx/node_modules/typescript/lib/tsc.js:52018:44)
at checkSourceElementWorker (/tmp/xx/node_modules/typescript/lib/tsc.js:52563:28)
at checkSourceElement (/tmp/xx/node_modules/typescript/lib/tsc.js:52408:17)
at Object.forEach (/tmp/xx/node_modules/typescript/lib/tsc.js:225:30)
at checkSourceFileWorker (/tmp/xx/node_modules/typescript/lib/tsc.js:52702:20)
at checkSourceFile (/tmp/xx/node_modules/typescript/lib/tsc.js:52676:13)
at getDiagnosticsWorker (/tmp/xx/node_modules/typescript/lib/tsc.js:52743:17)
at Object.getDiagnostics (/tmp/xx/node_modules/typescript/lib/tsc.js:52732:24)
at /tmp/xx/node_modules/typescript/lib/tsc.js:78489:85
at runWithCancellationToken (/tmp/xx/node_modules/typescript/lib/tsc.js:78464:24)
Related Issues:
- Crash when exporting
globalThis
indeclare global
block #33754 the stack trace looks different, though.