Add test for JSX import source resolution in script files - #1
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes microsoft#64438
Description
This PR adds a test case to verify that JSX runtime imports are resolved correctly in non-module script files (
.tsxfiles withoutexport), matching the behavior of module files.Changes
Added
jsxImportSourceScriptFile.tsxtest case with:/script.tsx) without module exports/module.tsx) with module exports@jsxImportSource: @solidjs/webdiv) and invalid (span) intrinsic elementsAdded corresponding baseline files:
jsxImportSourceScriptFile.errors.txt- Expected errors for both filesjsxImportSourceScriptFile.symbols.txt- Symbol resolution baselinejsxImportSourceScriptFile.types.txt- Type information baselineTest Plan
The test verifies that:
@jsxImportSourceimportsJSX.IntrinsicElements) are properly flagged as errors in both file typeshttps://claude.ai/code/session_01EYwZBkWeDkrW6qUbWvkRMg