Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when opening globalThis as a namespace #33860

Closed
shicks opened this issue Oct 7, 2019 · 0 comments · Fixed by #34561
Closed

Crash when opening globalThis as a namespace #33860

shicks opened this issue Oct 7, 2019 · 0 comments · Fixed by #34561
Assignees
Labels
Bug A bug in TypeScript

Comments

@shicks
Copy link
Contributor

shicks commented Oct 7, 2019

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)

Playground Link:
http://www.typescriptlang.org/play/index.html?ts=3.7-Beta&ssl=3&ssc=2&pln=1&pc=1#code/HYQwtgpgzgDiDGEAEBzANgewEYjQFQAsBLKJAbwCglqkIAPGDAJwBckAzAV2HhaI2AcMGABQBKckngCoGNBAB0mFCIDkdVWIDcSAL4VdQA

Related Issues:

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Oct 9, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.7.1 milestone Oct 9, 2019
@sandersn sandersn added Fix Available A PR has been opened for this issue and removed Fix Available A PR has been opened for this issue labels Oct 15, 2019
elibarzilay added a commit to elibarzilay/TypeScript that referenced this issue Oct 18, 2019
Fixes microsoft#33860 by making it an error.  This is an improvement, but sounds
like it would be better to make it work later.
elibarzilay added a commit that referenced this issue Oct 26, 2019
Fixes #33860 by making it an error.  This is an improvement, but sounds
like it would be better to make it work later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants