Skip to content

tsserver@2.1.1 crashes on the implicit tslib import when importHelpers is enabled #12142

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

Closed
Jessidhia opened this issue Nov 10, 2016 · 0 comments · Fixed by #12151
Closed

tsserver@2.1.1 crashes on the implicit tslib import when importHelpers is enabled #12142

Jessidhia opened this issue Nov 10, 2016 · 0 comments · Fixed by #12151
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@Jessidhia
Copy link

It looks like the list of imports provided by getSourceFile, ultimately used by getReferencedFiles, includes a tslib import, which seems reasonable.

However, the parent of the importName is Program itself, which does not have a parent. getSymbolAtLocation on the tslib import will, internally, call isExternalModuleImportEqualsDeclaration on the node.parent.parent, which doesn't exist, leading to a crash.

This prevents IntelliSense in VS Code from working at all.

A local hack that, because it was easy, I have implemented is wrapping the checker.getSymbolAtLocation call in Project.prototype.getReferencedFiles in a try/catch block that rethrows the exception unless importName.text === 'tslib'. This restores IntelliSense to working condition.

Including any tslib helper (by way of importHelpers) is enough to cause the crash.

async function x() {}
@Jessidhia Jessidhia changed the title tsserver@2.1.1 crashes on isExternalModuleImportEqualsDeclaration when importHelpers is enabled tsserver@2.1.1 crashes on the implicit tslib import when importHelpers is enabled Nov 10, 2016
@vladima vladima self-assigned this Nov 10, 2016
@vladima vladima added the Bug A bug in TypeScript label Nov 10, 2016
@mhegazy mhegazy added this to the TypeScript 2.1.3 milestone Nov 10, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Nov 10, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants