Uh oh!
There was an error while loading. Please reload this page.
Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163
Conversation
…NonInferrableType propagation Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
TypeScript Bot (@typescript-bot) test this |
There was a problem hiding this comment.
Pull request overview
Ports two TypeScript type-checker fixes from typescript-go into the main compiler: (1) correct subtype reduction behavior involving the internal anyFunctionType wildcard, and (2) ensure JSX children spread types propagate NonInferrableType so context-sensitive discrimination works for generic JSX component signatures.
Changes:
- Update signature relatedness so
anyFunctionTypeis treated as a subtype (source) but not as a supertype (target) of other function types. - Propagate
getPropagatingFlagsOfTypes(childrenTypes)into the object flags passed togetSpreadTypewhen synthesizing JSXchildren. - Add new compiler regression tests and reference baselines covering the subtype reduction and JSX children inference scenarios.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/compiler/checker.ts | Adjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing. |
| tests/cases/compiler/subtypeReductionWithAnyFunctionType.ts | New regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away. |
| tests/baselines/reference/subtypeReductionWithAnyFunctionType.types | Type baseline validating inferred types (notably the any parameter) for the new subtype reduction test. |
| tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbols | Symbols baseline for the new subtype reduction test. |
| tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txt | Error baseline asserting the expected TS7006 implicit-any diagnostic. |
| tests/cases/compiler/jsxFunctionTypeChildren.tsx | New regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario. |
| tests/baselines/reference/jsxFunctionTypeChildren.types | Type baseline for the JSX children function typing test. |
| tests/baselines/reference/jsxFunctionTypeChildren.symbols | Symbols baseline for the JSX children function typing test. |
| tests/cases/compiler/contextuallyTypedJsxChildren2.tsx | New regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop). |
| tests/baselines/reference/contextuallyTypedJsxChildren2.types | Type baseline validating correct inference (e.g. selected: number) for the JSX discrimination test. |
| tests/baselines/reference/contextuallyTypedJsxChildren2.symbols | Symbols baseline for the JSX discrimination test. |
TypeScript Bot (typescript-bot)
commented
Feb 19, 2026
Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details. |
Jake Bailey (jakebailey)
commented
Feb 20, 2026
TypeScript Bot (typescript-bot)
commented
Feb 20, 2026
Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
TypeScript Bot (typescript-bot)
commented
Feb 20, 2026
Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details. |
TypeScript Bot (typescript-bot)
commented
Feb 20, 2026
Daniel Rosenwasser (@DanielRosenwasser) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Feb 20, 2026
Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
Jake Bailey (jakebailey)
commented
Feb 20, 2026
DT is still broken due to the wordpress package 404, but the PR itself seems correct? |
Anders Hejlsberg (ahejlsberg)
commented
Feb 20, 2026
PR looks good to me, but was waiting to see DT results. |
Jake Bailey (jakebailey)
commented
Feb 20, 2026
Fixed DT. |
TypeScript Bot (typescript-bot)
commented
Feb 20, 2026
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. Everything looks the same! |
Connor Shea (connorshea)
commented
Mar 3, 2026
Since I saw a ts6 rc may go out soon, figured I'd comment and note this would be good to have for parity with TS7 🙏 |
Jake Bailey (jakebailey)
commented
Mar 3, 2026
Oops, this was meant to be merged |
TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG |
Connor Shea (connorshea)
commented
Mar 3, 2026
I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always! |
TypeScript Bot (typescript-bot)
commented
Mar 3, 2026
Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you. |
Uh oh!
There was an error while loading. Please reload this page.
…e-6.0 (#63208) Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Ports two fixes from typescript-go:
anyFunctionTypea subtype of all function types typescript-go#1149 — MakeanyFunctionTypea subtype of all function typesanyFunctionTypesubtype relationIn
signaturesRelatedTo,anyFunctionTypewas treated symmetrically—both as source and target it returnedTernary.True. This caused incorrect subtype reduction: when a union includedanyFunctionTypealongside a real function type, the real type could be reduced away instead of the wildcard.Now
anyFunctionTypeis a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:JSX children
NonInferrableTypepropagationWhen building the JSX attributes spread type for children,
getPropagatingFlagsOfTypes(childrenTypes)was not included in theobjectFlagspassed togetSpreadType. This meant theNonInferrableTypeflag fromanyFunctionTypechildren wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.