Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go - #63163

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype
Mar 3, 2026
Merged

Port anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-go#63163
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/port-function-type-subtype

Conversation

CopilotAI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Ports two fixes from typescript-go:

anyFunctionType subtype relation

In signaturesRelatedTo, anyFunctionType was treated symmetrically—both as source and target it returned Ternary.True. This caused incorrect subtype reduction: when a union included anyFunctionType alongside a real function type, the real type could be reduced away instead of the wildcard.

Now anyFunctionType is a proper subtype (source → True) but not a supertype (target → False). This fixes inference in patterns like:

declarefunctionuseMemo<T>(func: ()=>T): T;constpredicate=useMemo(()=>{if(cond)return()=>true;// anyFunctionTypereturnx=>x.length>0;// previously inferred x: string, now correctly x: any + TS7006});

JSX children NonInferrableType propagation

When building the JSX attributes spread type for children, getPropagatingFlagsOfTypes(childrenTypes) was not included in the objectFlags passed to getSpreadType. This meant the NonInferrableType flag from anyFunctionType children wasn't propagated, breaking context-sensitive discrimination for generic JSX component signatures.

// children as JSX body now correctly infers `selected: number`<TestComponentstate={{foo: 123}}selector={(state)=>state.foo}>{(selected)=><div>{Math.max(selected,0)}</div>}</TestComponent>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…NonInferrableType propagation
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
CopilotAI changed the title [WIP] Port changes from multiple PRs on function types and JSXPort anyFunctionType subtype fix and JSX children NonInferrableType propagation from typescript-goFeb 19, 2026
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started❌ Results
perf test this faster✅ Started👀 Results

CopilotAI 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.

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 anyFunctionType is treated as a subtype (source) but not as a supertype (target) of other function types.
  • Propagate getPropagatingFlagsOfTypes(childrenTypes) into the object flags passed to getSpreadType when synthesizing JSX children.
  • 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
FileDescription
src/compiler/checker.tsAdjusts anyFunctionType signature relatedness semantics; propagates children flags (incl. NonInferrableType) into JSX children spread typing.
tests/cases/compiler/subtypeReductionWithAnyFunctionType.tsNew regression test for union subtype reduction involving anyFunctionType, ensuring real function types aren’t incorrectly reduced away.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.typesType baseline validating inferred types (notably the any parameter) for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.symbolsSymbols baseline for the new subtype reduction test.
tests/baselines/reference/subtypeReductionWithAnyFunctionType.errors.txtError baseline asserting the expected TS7006 implicit-any diagnostic.
tests/cases/compiler/jsxFunctionTypeChildren.tsxNew regression test ensuring JSX children function typing behaves like the equivalent non-JSX call in a generic props scenario.
tests/baselines/reference/jsxFunctionTypeChildren.typesType baseline for the JSX children function typing test.
tests/baselines/reference/jsxFunctionTypeChildren.symbolsSymbols baseline for the JSX children function typing test.
tests/cases/compiler/contextuallyTypedJsxChildren2.tsxNew regression test for context-sensitive JSX children discrimination with generic signatures (children-body vs non-children prop).
tests/baselines/reference/contextuallyTypedJsxChildren2.typesType baseline validating correct inference (e.g. selected: number) for the JSX discrimination test.
tests/baselines/reference/contextuallyTypedJsxChildren2.symbolsSymbols baseline for the JSX discrimination test.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started❌ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user tests with tsc comparing main and refs/pull/63163/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols82,52182,521~~~p=1.000 n=6
Types125,280125,280~~~p=1.000 n=6
Memory used275,082k (± 0.50%)276,155k (± 0.67%)~274,428k277,929kp=0.471 n=6
Parse Time1.30s (± 0.42%)1.30s (± 0.63%)~1.29s1.31sp=0.859 n=6
Bind Time0.76s (± 0.68%)0.75s (± 0.68%)~0.75s0.76sp=0.311 n=6
Check Time14.16s (± 0.41%)14.15s (± 0.50%)~14.04s14.25sp=1.000 n=6
Emit Time2.67s (± 0.39%)2.66s (± 0.61%)~2.64s2.68sp=1.000 n=6
Total Time18.88s (± 0.31%)18.87s (± 0.36%)~18.77s18.97sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols959,126959,126~~~p=1.000 n=6
Types416,034416,034~~~p=1.000 n=6
Memory used1,260,822k (± 0.00%)1,260,855k (± 0.00%)~1,260,780k1,260,915kp=0.298 n=6
Parse Time6.51s (± 0.48%)6.55s (± 0.63%)~6.50s6.62sp=0.221 n=6
Bind Time1.97s (± 0.38%)1.97s (± 0.21%)~1.97s1.98sp=0.389 n=6
Check Time32.45s (± 0.28%)32.34s (± 0.29%)~32.19s32.48sp=0.065 n=6
Emit Time15.09s (± 0.35%)15.07s (± 0.36%)~15.01s15.17sp=0.518 n=6
Total Time56.02s (± 0.25%)55.92s (± 0.17%)~55.83s56.04sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors11,43911,439~~~p=1.000 n=6
Symbols2,706,6202,706,879+259 (+ 0.01%)~~p=0.001 n=6
Types931,168931,241+73 (+ 0.01%)~~p=0.001 n=6
Memory used3,046,078k (± 0.00%)3,046,217k (± 0.01%)~3,046,108k3,046,500kp=0.066 n=6
Parse Time8.53s (± 0.29%)8.53s (± 0.35%)~8.47s8.55sp=0.685 n=6
Bind Time2.31s (± 0.42%)2.32s (± 0.18%)~2.32s2.33sp=0.056 n=6
Check Time95.50s (± 0.60%)95.42s (± 0.39%)~95.10s95.93sp=0.873 n=6
Emit Time0.32s (± 1.97%)0.32s (± 2.34%)~0.31s0.33sp=0.718 n=6
Total Time106.66s (± 0.53%)106.59s (± 0.33%)~106.28s107.05sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used2,396,837k (± 0.04%)2,518,404k (±11.85%)~2,395,920k3,128,223kp=0.810 n=6
Parse Time5.19s (± 1.45%)5.18s (± 1.41%)~5.11s5.29sp=1.000 n=6
Bind Time1.87s (± 0.55%)1.84s (± 1.27%)-0.03s (- 1.61%)1.81s1.87sp=0.041 n=6
Check Time35.69s (± 0.28%)35.69s (± 0.48%)~35.50s35.98sp=0.936 n=6
Emit Time2.99s (± 1.21%)3.02s (± 2.75%)~2.92s3.13sp=0.471 n=6
Total Time45.77s (± 0.36%)45.76s (± 0.41%)~45.49s46.02sp=0.873 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,253,4071,253,407~~~p=1.000 n=6
Types260,208260,208~~~p=1.000 n=6
Memory used3,073,635k (± 9.65%)3,072,946k (± 9.66%)~2,466,271k3,194,475kp=0.471 n=6
Parse Time8.44s (± 1.65%)8.43s (± 1.43%)~8.23s8.58sp=0.936 n=6
Bind Time2.74s (± 1.68%)2.77s (± 1.27%)~2.73s2.83sp=0.108 n=6
Check Time53.56s (± 0.46%)53.37s (± 0.17%)~53.28s53.53sp=0.093 n=6
Emit Time4.36s (± 1.51%)4.33s (± 2.01%)~4.23s4.42sp=0.810 n=6
Total Time69.11s (± 0.53%)68.91s (± 0.32%)~68.58s69.12sp=0.297 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,173265,173~~~p=1.000 n=6
Types104,282104,282~~~p=1.000 n=6
Memory used444,507k (± 0.02%)444,537k (± 0.01%)~444,466k444,624kp=0.936 n=6
Parse Time3.52s (± 1.40%)3.52s (± 0.83%)~3.48s3.57sp=1.000 n=6
Bind Time1.38s (± 0.79%)1.37s (± 1.41%)~1.36s1.41sp=0.187 n=6
Check Time19.29s (± 0.35%)19.28s (± 0.38%)~19.21s19.41sp=0.810 n=6
Emit Time1.54s (± 0.68%)1.55s (± 1.29%)~1.53s1.58sp=1.000 n=6
Total Time25.73s (± 0.44%)25.73s (± 0.22%)~25.67s25.82sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors271271~~~p=1.000 n=6
Symbols225,883225,883~~~p=1.000 n=6
Types93,56493,564~~~p=1.000 n=6
Memory used371,591k (± 0.02%)371,612k (± 0.01%)~371,568k371,647kp=0.230 n=6
Parse Time2.86s (± 0.57%)2.83s (± 1.38%)~2.76s2.87sp=0.089 n=6
Bind Time1.63s (± 1.58%)1.63s (± 1.38%)~1.59s1.66sp=0.803 n=6
Check Time17.46s (± 0.35%)17.46s (± 0.41%)~17.38s17.57sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.96s (± 0.18%)21.92s (± 0.37%)~21.81s22.04sp=0.332 n=6
vscode - node (v18.15.0, x64)
Errors5757~~~p=1.000 n=5+6
Symbols4,359,7234,359,721-2 (- 0.00%)~~p=0.002 n=5+6
Types1,386,3481,386,348~~~p=1.000 n=5+6
Memory used4,162,029k (± 0.01%)4,162,113k (± 0.00%)~4,161,912k4,162,318kp=0.411 n=5+6
Parse Time16.67s (± 0.70%)16.66s (± 0.75%)~16.54s16.86sp=0.855 n=5+6
Bind Time5.67s (± 1.15%)5.64s (± 0.29%)~5.62s5.66sp=0.167 n=5+6
Check Time138.15s (± 2.79%)142.66s (± 3.94%)~134.85s148.92sp=0.235 n=5+6
Emit Time88.34s (± 4.34%)88.31s (± 4.40%)~84.49s92.23sp=0.784 n=5+6
Total Time248.82s (± 1.90%)253.28s (± 1.42%)~249.58s258.99sp=0.055 n=5+6
webpack - node (v18.15.0, x64)
Errors4141~~~p=1.000 n=6
Symbols407,330407,330~~~p=1.000 n=6
Types186,189186,189~~~p=1.000 n=6
Memory used568,814k (± 0.01%)568,750k (± 0.01%)~568,667k568,794kp=0.128 n=6
Parse Time4.81s (± 0.61%)4.78s (± 0.45%)~4.75s4.81sp=0.124 n=6
Bind Time2.04s (± 1.79%)2.04s (± 1.05%)~2.01s2.06sp=1.000 n=6
Check Time24.66s (± 0.26%)24.47s (± 0.60%)-0.20s (- 0.79%)24.22s24.63sp=0.013 n=6
Emit Time0.00s (±154.76%)0.00s (±154.76%)~0.00s0.01sp=1.000 n=6
Total Time31.52s (± 0.26%)31.30s (± 0.50%)-0.22s (- 0.70%)31.03s31.47sp=0.013 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols764,198764,198~~~p=1.000 n=6
Types219,050219,050~~~p=1.000 n=6
Memory used684,903k (± 0.01%)684,850k (± 0.01%)~684,762k684,948kp=0.173 n=6
Parse Time4.89s (± 0.83%)4.92s (± 0.73%)~4.87s4.97sp=0.146 n=6
Bind Time1.57s (± 0.48%)1.59s (± 1.05%)~1.57s1.61sp=0.080 n=6
Check Time22.56s (± 0.52%)22.60s (± 0.53%)~22.47s22.75sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.02s (± 0.42%)29.11s (± 0.39%)~28.99s29.30sp=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/63163/merge:

Everything looks good!

@jakebailey

Copy link
Copy Markdown
Member

DT is still broken due to the wordpress package 404, but the PR itself seems correct?

@ahejlsberg

Copy link
Copy Markdown
Member

PR looks good to me, but was waiting to see DT results.

@jakebailey

Copy link
Copy Markdown
Member

Fixed DT.

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@connorshea

Copy link
Copy Markdown
Contributor

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 🙏

@jakebailey

Copy link
Copy Markdown
Member

Oops, this was meant to be merged

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-6.0 and LKG

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
cherry-pick this to release-6.0 and LKG✅ Started✅ Results

@connorshea

Copy link
Copy Markdown
Contributor

Oops, this was meant to be merged

I'm glad, because I always feel rude making comments like this 😅 Thanks for all the work, as always!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #63208 for you.

Merged via the queue into main with commit c9e7428Mar 3, 2026
28 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/port-function-type-subtype branch March 3, 2026 02:14
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Mar 3, 2026
…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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@DanielRosenwasser@typescript-bot@jakebailey@ahejlsberg@connorshea@andrewbranch