Skip to content

[email protected] crashes on the implicit tslib import when importHelpers is enabled #12142

Closed
@Jessidhia

Description

@Jessidhia

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() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions