Skip to content

Fix JSX intrinsic tag error reporting - #65359

Open
Ayush Tripathi (ayushtripathi-45) wants to merge 4 commits into
microsoft:mainfrom
ayushtripathi-45:fix/jsx-error-reporting-65316
Open

Ayush Tripathi (ayushtripathi-45) wants to merge 4 commits into
microsoft:mainfrom
ayushtripathi-45:fix/jsx-error-reporting-65316

Conversation

@ayushtripathi-45

@ayushtripathi-45 Ayush Tripathi (ayushtripathi-45) commented Nov 6, 2026 •

Copy link
Copy Markdown

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

  • Avoid duplicate diagnostics on JSX closing tags when the corresponding opening tag has already failed intrinsic tag resolution.
  • Prevent redundant TS2604 diagnostics when TS2339 has already been reported for an invalid intrinsic JSX element type.
  • Report missing intrinsic element property errors on the JSX tag name rather than the entire JSX element.
  • Preserve closing-tag symbol resolution for editor features such as rename and go to definition.

Tests

  • Added regression tests for invalid intrinsic JSX tags and property-access JSX components.
  • Added React JSX coverage using react-jsx.
  • Updated affected diagnostic reference baselines.

Validation

  • Code changes committed and pushed to the PR branch.
  • Regression tests added and targeted tests passing.
  • npx hereby build — passed.
  • npx hereby lint — passed (0 issues).
  • npx hereby check:format — passed.
  • git diff --check — passed.
  • Targeted JSX regression tests passed, including jsxIntrinsicTagErrorReporting, jsxIntrinsicTagErrorReportingReact, and jsxFragmentWrongType.
  • npx hereby test — attempted; encountered Windows environment failures and baseline mismatches. The JSX baseline mismatches were subsequently corrected and targeted tests passed.
  • Full CI and CodeQL — awaiting maintainer approval.
  • Associated issue milestone — not independently verified.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:02
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 6, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 6, 2026

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.

🟡 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

Comment thread tsc/internal/checker/jsx.go Resolved
Comment thread tsc/internal/checker/jsx.go Resolved

This branch has not been deployed

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

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

JSX error reporting is inconsistent

2 participants