Skip to content

Add test for JSX import source resolution in script files - #1

Merged
pmudassir merged 1 commit into
mainfrom
claude/jolly-darwin-o4g1hp
Oct 1, 2026
Merged

pmudassir merged 1 commit into
mainfrom
claude/jolly-darwin-o4g1hp

Conversation

@pmudassir

Copy link
Copy Markdown
Owner

Fixes microsoft#64438

Description

This PR adds a test case to verify that JSX runtime imports are resolved correctly in non-module script files (.tsx files without export), matching the behavior of module files.

Changes

  • Added jsxImportSourceScriptFile.tsx test case with:

    • A script file (/script.tsx) without module exports
    • A module file (/module.tsx) with module exports
    • Both files using JSX with @jsxImportSource: @solidjs/web
    • Verification that both files resolve the JSX runtime import identically
    • Test cases for valid (div) and invalid (span) intrinsic elements
  • Added corresponding baseline files:

    • jsxImportSourceScriptFile.errors.txt - Expected errors for both files
    • jsxImportSourceScriptFile.symbols.txt - Symbol resolution baseline
    • jsxImportSourceScriptFile.types.txt - Type information baseline

Test Plan

The test verifies that:

  1. Script files correctly resolve @jsxImportSource imports
  2. Both script and module files produce identical type checking results
  3. Invalid JSX elements (not in JSX.IntrinsicElements) are properly flagged as errors in both file types

https://claude.ai/code/session_01EYwZBkWeDkrW6qUbWvkRMg

Script files (no imports or exports) used to report TS2875 and TS7026
when using an implicit JSX runtime, even with the runtime package
installed, because the implicit `jsx-runtime` import was only
synthesized for module files. That was fixed by
microsoft/typescript-go#3803, but no test covered this scenario
directly.

This test checks that a script file resolves the runtime's JSX namespace
the same way a module does.

Fixes microsoft#64438

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYwZBkWeDkrW6qUbWvkRMg
@pmudassir
pmudassir merged commit 2295ba1 into main Oct 1, 2026
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.

Incorrect/unhelpful error message for non-module jsx file

2 participants