Skip to content

Recognize jsxImportSource namespaces in checked JavaScript - #4694

Merged
jakebailey merged 2 commits into
mainfrom
copilot/fix-jsx-namespace-recognition
Jul 21, 2026
Merged

Recognize jsxImportSource namespaces in checked JavaScript#4694
jakebailey merged 2 commits into
mainfrom
copilot/fix-jsx-namespace-recognition

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Checked .js files using jsxImportSource failed to resolve the runtime module’s JSX namespace, while equivalent .tsx files worked.

// checkJs: true, jsxImportSource: "preact"
<div />;
  • Root cause

    • JSX runtime imports were synthesized for JSX/TSX script kinds, excluding .js files.
  • Change

    • Include JavaScript source files when synthesizing JSX runtime imports.
    • Add compiler coverage verifying JSX.IntrinsicElements resolves from preact/jsx-runtime.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix JSX namespace recognition issue for JS files Recognize jsxImportSource namespaces in checked JavaScript Jul 21, 2026
Copilot AI requested a review from jakebailey July 21, 2026 17:49

@jakebailey jakebailey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, the classic "JS is actually JSX" thing

@jakebailey
jakebailey marked this pull request as ready for review July 21, 2026 17:51
Copilot AI review requested due to automatic review settings July 21, 2026 17:51
@jakebailey
jakebailey enabled auto-merge July 21, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends JSX runtime namespace resolution to checked JavaScript files.

Changes:

  • Synthesizes JSX runtime imports for .js and .jsx files.
  • Adds compiler coverage with type and symbol baselines.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/compiler/fileloader.go Includes JavaScript files in JSX runtime import resolution.
testdata/tests/cases/compiler/jsxImportSourceCheckJs.ts Adds the regression test.
testdata/baselines/reference/compiler/jsxImportSourceCheckJs.types Verifies resolved JSX element types.
testdata/baselines/reference/compiler/jsxImportSourceCheckJs.symbols Verifies intrinsic element symbol resolution.

@jakebailey
jakebailey added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 42bb833 Jul 21, 2026
22 checks passed
@jakebailey
jakebailey deleted the copilot/fix-jsx-namespace-recognition branch July 21, 2026 18:27
@caseywebdev

Copy link
Copy Markdown

Awesome, thanks 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

checkJs + jsxImportSource does not recognize JSX namespace

5 participants