typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Handle import helpers and JSX factory imports

Open jakebailey opened this issue 8 months ago • 0 comments

Fixes #765 Fixes #767 Includes #779 until that's merged.

This implements import helper and JSX factory import node synthesis and resolution. Since the AST node is ummutable, we cannot modify SourceFile.Imports. This info is now stored on the Program rather than at special fixed instances in imports.

This should allow us to reuse ASTs more often, and means we stop having to work around these synthezied imports in other parts of the code (LS features, mainly).

This PR isn't perfect; it turns out we're missing implementations of moduleDetection and externalModuleIndicator, so we're not correctly determining that JSX files are modules because the jsx setting plays a part in determining if a file is a module (yay).

Fixing that will have to be a follow-up PR but that's going to be a lot more invasive.

(actual fix is the last two commits of this PR as of sending)

jakebailey avatar Apr 09 '25 03:04 jakebailey