Repository navigation
Fix JSX intrinsic tag error reporting - #65359
Open
Ayush Tripathi (ayushtripathi-45) wants to merge 4 commits into
Open
Ayush Tripathi (ayushtripathi-45) wants to merge 4 commits into
Ayush Tripathi (ayushtripathi-45) wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The JSX changes can crash the compiler on fragments with missing intrinsic types and introduce cascading props and children diagnostics for missing component tags.
2 open issues
What changed in this PR
This PR addresses #65316 by improving JSX diagnostics in the native TypeScript checker: reducing redundant errors and highlighting invalid tag names more precisely.
Changes:
- Suppresses repeated intrinsic-tag diagnostics on closing tags while retaining symbol resolution.
- Narrows missing-property errors to tag names and changes recovery to avoid redundant TS2604 diagnostics.
- Adds compiler regression tests and updates diagnostic, type, and symbol baselines.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/jsxIntrinsicTagErrorReportingReact.tsx |
Adds React JSX regression coverage. |
tsc/testdata/tests/cases/compiler/jsxIntrinsicTagErrorReporting.tsx |
Adds intrinsic and property-access tag cases. |
tsc/testdata/baselines/reference/conformance/tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/conformance/tsxSpreadAttributesResolution17.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/conformance/tsxReactEmitNesting.errors.txt |
Updates nested JSX diagnostic counts. |
tsc/testdata/baselines/reference/conformance/tsxNamespacedTagName2.errors.txt |
Deduplicates namespaced-tag errors. |
tsc/testdata/baselines/reference/conformance/tsxNamespacedTagName1.errors.txt |
Deduplicates namespaced-tag errors. |
tsc/testdata/baselines/reference/conformance/tsxNamespacedAttributeName2.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/conformance/tsxNamespacedAttributeName1.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/conformance/tsxExternalModuleEmit1.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/conformance/tsxErrorRecovery3.errors.txt |
Updates error-recovery diagnostics. |
tsc/testdata/baselines/reference/conformance/tsxErrorRecovery2.errors.txt |
Updates error-recovery diagnostics. |
tsc/testdata/baselines/reference/conformance/tsxErrorRecovery1.errors.txt |
Updates malformed-tag diagnostics. |
tsc/testdata/baselines/reference/conformance/tsxElementResolution6.errors.txt |
Narrows missing-property error span. |
tsc/testdata/baselines/reference/conformance/tsxElementResolution1.errors.txt |
Narrows missing-property error span. |
tsc/testdata/baselines/reference/conformance/tsxDynamicTagName3.errors.txt |
Removes TS2604 and narrows TS2339. |
tsc/testdata/baselines/reference/conformance/tsxDynamicTagName2.errors.txt |
Deduplicates and narrows tag errors. |
tsc/testdata/baselines/reference/conformance/tsxCorrectlyParseLessThanComparison1.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/conformance/jsxReactTestSuite.errors.txt |
Updates React suite diagnostic counts. |
tsc/testdata/baselines/reference/conformance/jsxInvalidEsprimaTestSuite.errors.txt |
Deduplicates invalid-JSX diagnostics. |
tsc/testdata/baselines/reference/conformance/jsxEsprimaFbTestSuite.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/conformance/jsxAndTypeAssertion.errors.txt |
Deduplicates JSX recovery diagnostics. |
tsc/testdata/baselines/reference/compiler/useBeforeDeclaration_jsx.errors.txt |
Preserves initialization errors while deduplicating JSX errors. |
tsc/testdata/baselines/reference/compiler/jsxTernaryWithObjectInAttribute.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxNestedWithinTernaryParsesCorrectly.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxNamespacePrefixIntrinsics.errors.txt |
Narrows missing intrinsic-property span. |
tsc/testdata/baselines/reference/compiler/jsxNamespacePrefixInNameReact.errors.txt |
Deduplicates React namespaced-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxNamespacePrefixInName.errors.txt |
Deduplicates namespaced-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/compiler/jsxMultilineAttributeValuesReact.errors.txt |
Deduplicates multiline React JSX errors. |
tsc/testdata/baselines/reference/compiler/jsxMultilineAttributeStringValues.errors.txt |
Deduplicates multiline JSX errors. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReportingReact.types |
Records React regression-test types. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReportingReact.symbols |
Records React tag symbol resolution. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReportingReact.errors.txt |
Records React regression diagnostics. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReporting.types |
Records regression-test types. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReporting.symbols |
Records regression-test symbol resolution. |
tsc/testdata/baselines/reference/compiler/jsxIntrinsicTagErrorReporting.errors.txt |
Records intrinsic and mismatched-tag diagnostics. |
tsc/testdata/baselines/reference/compiler/jsxInExtendsClause.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/compiler/jsxHash.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxFactoryButNoJsxFragmentFactory.errors.txt |
Deduplicates JSX errors alongside factory diagnostics. |
tsc/testdata/baselines/reference/compiler/jsxFactoryAndJsxFragmentFactoryNull.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.errors.txt |
Preserves factory error while deduplicating JSX errors. |
tsc/testdata/baselines/reference/compiler/jsxFactoryAndJsxFragmentFactory.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxEntityDecoderAfterNonEntityAmpersand.errors.txt |
Removes duplicate closing-tag errors. |
tsc/testdata/baselines/reference/compiler/jsxElementTypeLiteralWithGeneric.errors.txt |
Narrows missing intrinsic-property span. |
tsc/testdata/baselines/reference/compiler/jsxElementTypeLiteral.errors.txt |
Narrows missing intrinsic-property span. |
tsc/testdata/baselines/reference/compiler/jsxElementType.errors.txt |
Narrows undeclared intrinsic-tag spans. |
tsc/testdata/baselines/reference/compiler/jsxAttributeMissingInitializer.errors.txt |
Removes duplicate closing-tag error. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=legacy).errors.txt |
Deduplicates React/legacy diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).errors.txt |
Deduplicates React/force diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=auto).errors.txt |
Deduplicates React/auto diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=legacy).errors.txt |
Deduplicates development-runtime/legacy diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt |
Deduplicates development-runtime/force diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).errors.txt |
Deduplicates development-runtime/auto diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=legacy).errors.txt |
Deduplicates automatic-runtime/legacy diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt |
Deduplicates automatic-runtime/force diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).errors.txt |
Deduplicates automatic-runtime/auto diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=legacy).errors.txt |
Deduplicates preserve/legacy diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).errors.txt |
Deduplicates preserve/force diagnostics. |
tsc/testdata/baselines/reference/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=auto).errors.txt |
Deduplicates preserve/auto diagnostics. |
tsc/internal/checker/jsx.go |
Implements diagnostic suppression, targeting, and recovery changes. |
Review effort: Balanced
This branch has not been deployed
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 #65316
Summary
Improves JSX diagnostic reporting for invalid intrinsic tags and prevents redundant diagnostics when JSX opening and closing tags cannot be resolved.
Changes
Tests
react-jsx.Validation
npx hereby build— passed.npx hereby lint— passed (0 issues).npx hereby check:format— passed.git diff --check— passed.jsxIntrinsicTagErrorReporting,jsxIntrinsicTagErrorReportingReact, andjsxFragmentWrongType.npx hereby test— attempted; encountered Windows environment failures and baseline mismatches. The JSX baseline mismatches were subsequently corrected and targeted tests passed.