Skip to content

Preserve primitive literal union origins without special intersections - #64411

Open
Wesley Wigham (weswigham) wants to merge 7 commits into
microsoft:mainfrom
weswigham:aliased-primitives
Open

Wesley Wigham (weswigham) wants to merge 7 commits into
microsoft:mainfrom
weswigham:aliased-primitives

Conversation

@weswigham

Copy link
Copy Markdown
Member

And reduce string & {}, number & {}, and bigint & {} normally. This preserves redundant literals alongside their matching broad primitive in an "origin" checker link. These origins are used for completions, quick info, and mapped-key enumeration without changing ordinary type printing (for compatibility with the old & {} patterns - I think these origins affecting mapped type keys is odd, but I understand the usefulness, at least)

Strada history:

Ultimately, this PR gives you an editor experience like this:

Recording.2026-09-23.133101.mp4

Without needing to opt into a weird string & {} pattern that triggers a bunch of normalization exceptions through the checker. Note the specialized origin-retaining quickinfo that can print the full union origin of the string type, and the now-functional string literal completions in a case where before we did not have them (without writing string & {} instead of string to opt in to a denormalized union).

Reduce string & {}, number & {}, and bigint & {} normally. Preserve redundant literals alongside their matching broad primitive in sparse origin metadata. Use the origins for completions, quick info, and mapped-key enumeration without changing ordinary type printing. Recognize origin-bearing primitive copies in index-signature and union comparisons.

Strada history:
- microsoft#28429 first allowed string & {} to survive by preserving actual empty object intersections.
  microsoft#28429
- microsoft#49119 introduced noSupertypeReduction for string, number, and bigint intersections, explicitly documenting and testing the completion exception in completionPreferredSuggestions1.ts.
  microsoft#49119
Copilot AI balanced review requested due to automatic review settings September 23, 2026 20:39
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 23, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Origin metadata is still lost during control-flow filtering and nested union composition, producing incomplete completions and quick info.

Review effort: Balanced
Findings: None

What changed in this PR

Preserves primitive literal union origins for completions, quick info, and mapped keys while normally reducing legacy primitive intersections.

Changes:

  • Adds reduced-union origin metadata.
  • Updates language-service consumers.
  • Expands compiler and fourslash coverage.
File Reviewed change
tsc/​testdata/​tests/​cases/​compiler/​templateLiteralOriginReduction.ts Tests template-literal origin reduction.
tsc/​testdata/​tests/​cases/​compiler/​stringOriginIndexSignatures.ts Tests string-origin index signatures.
tsc/​testdata/​tests/​cases/​compiler/​numericLiteralOrigins.ts Tests numeric and bigint origins.
tsc/​testdata/​tests/​cases/​compiler/​mappedStringLiteralOrigin.ts Tests mapped string-literal origins.
tsc/​testdata/​tests/​cases/​compiler/​emptyObjectIntersectionReduction.ts Tests empty-object intersection reduction.
tsc/​testdata/​baselines/​reference/​fourslash/​quickInfo/​quickInfoStringLiteralOrigin_plaintext.baseline Records plaintext quick-info output.
tsc/​testdata/​baselines/​reference/​fourslash/​quickInfo/​quickInfoStringLiteralOrigin_markdown.baseline Records Markdown quick-info output.
tsc/​testdata/​baselines/​reference/​conformance/​unknownControlFlow.types Updates control-flow type baselines.
tsc/​testdata/​baselines/​reference/​conformance/​templateLiteralTypesPatterns.types Updates template-pattern type baselines.
tsc/​testdata/​baselines/​reference/​conformance/​templateLiteralTypes2.types Updates template-literal type baselines.
tsc/​testdata/​baselines/​reference/​conformance/​stringMappingReduction.types Updates string-mapping reduction baselines.
tsc/​testdata/​baselines/​reference/​compiler/​templateLiteralOriginReduction.types Records template-origin types.
tsc/​testdata/​baselines/​reference/​compiler/​templateLiteralOriginReduction.symbols Records template-origin symbols.
tsc/​testdata/​baselines/​reference/​compiler/​templateLiteralOriginReduction.js Records template-origin emit.
tsc/​testdata/​baselines/​reference/​compiler/​templateLiteralOriginReduction.errors.txt Records template-origin diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=true).types Records checked index-signature types.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=true).symbols Records checked index-signature symbols.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=true).js Records checked index-signature emit.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=true).errors.txt Records checked index-signature diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=false).types Records unchecked index-signature types.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=false).symbols Records unchecked index-signature symbols.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=false).js Records unchecked index-signature emit.
tsc/​testdata/​baselines/​reference/​compiler/​stringOriginIndexSignatures(nouncheckedindexedaccess=false).errors.txt Records unchecked index-signature diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​specialIntersectionsInMappedTypes.types Updates mapped-intersection types.
tsc/​testdata/​baselines/​reference/​compiler/​numericLiteralOrigins.types Records numeric-origin types.
tsc/​testdata/​baselines/​reference/​compiler/​numericLiteralOrigins.symbols Records numeric-origin symbols.
tsc/​testdata/​baselines/​reference/​compiler/​numericLiteralOrigins.js Records numeric-origin emit.
tsc/​testdata/​baselines/​reference/​compiler/​numericLiteralOrigins.errors.txt Records numeric-origin diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​nestedGenericTypeInference.types Updates generic-inference types.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=true).types Records exact-optional mapped types.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=true).symbols Records exact-optional mapped symbols.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=true).js Records exact-optional mapped emit.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=true).errors.txt Records exact-optional mapped diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=false).types Records standard mapped types.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=false).symbols Records standard mapped symbols.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=false).js Records standard mapped emit.
tsc/​testdata/​baselines/​reference/​compiler/​mappedStringLiteralOrigin(exactoptionalpropertytypes=false).errors.txt Records standard mapped diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=true).types Records strict-null intersection types.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=true).symbols Records strict-null intersection symbols.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=true).js Records strict-null intersection emit.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=false).types Records non-strict intersection types.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=false).symbols Records non-strict intersection symbols.
tsc/​testdata/​baselines/​reference/​compiler/​emptyObjectIntersectionReduction(strictnullchecks=false).js Records non-strict intersection emit.
tsc/​internal/​ls/​string_completions.go Traverses origins for string completions.
tsc/​internal/​ls/​hover.go Uses origins in quick info.
tsc/​internal/​ls/​completions.go Uses literal origins for completions.
tsc/​internal/​fourslash/​tests/​templateLiteralOriginCompletions_test.go Tests template-literal completions.
tsc/​internal/​fourslash/​tests/​stringLiteralCompletionsFromReducedUnion_test.go Tests reduced string-union completions.
tsc/​internal/​fourslash/​tests/​specialIntersectionsOrderIndependent_test.go Tests intersection order independence.
tsc/​internal/​fourslash/​tests/​reducedOriginInstantiation_test.go Tests instantiated origins.
tsc/​internal/​fourslash/​tests/​quickInfoStringLiteralOrigin_test.go Tests string-origin quick info.
tsc/​internal/​fourslash/​tests/​quickInfoNumericLiteralOrigin_test.go Tests numeric-origin quick info.
tsc/​internal/​fourslash/​tests/​numericLiteralCompletionsFromReducedUnion_test.go Tests reduced numeric-union completions.
tsc/​internal/​checker/​types.go Defines reduced-type origin links.
tsc/​internal/​checker/​relater.go Updates origin-bearing type relationships.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@weswigham

Copy link
Copy Markdown
Member Author

Origin metadata is still lost during control-flow filtering and nested union composition, producing incomplete completions and quick info.

Well yeah, intentionally. Control flow will happily narrow to a non-origin'd version of the type, at which point the info is gone (ofc), likewise with quick info. Quickinfo is also only displayed on types that are exactly a type with an origin - a type with an origin embedded within another type (union, object, intersection, conditional, whatever), doesn't display any differently than the base type it aliases (though I can see a world where we use expandable hover and some kind of hint decoration to allow expanding to see the origin in those cases, it's not in this PR).

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,276 115,363 +87 (+ 0.08%) ~ ~ p=0.000 n=12
Types 79,613 80,044 +431 (+ 0.54%) ~ ~ p=0.000 n=12
Memory Used 142,685k (± 0.50%) 142,346k (± 0.39%) ~ 140,932k 143,639k p=0.443 n=12
Memory Allocs 2,193,473 (± 0.00%) 2,194,374 (± 0.00%) +901 (+ 0.04%) 2,194,230 2,194,592 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.041s (± 4.01%) 0.041s (± 2.38%) ~ 0.038s 0.043s p=0.602 n=12
Bind Time 0.013s (±14.87%) 0.012s (±10.75%) ~ 0.010s 0.016s p=0.972 n=12
Check Time 0.494s (± 0.88%) 0.516s (± 0.89%) 🔻+0.022s (+ 4.42%) 0.509s 0.535s p=0.000 n=12
Emit Time 0.266s (± 1.65%) 0.270s (± 2.89%) ~ 0.247s 0.292s p=0.384 n=12
Total Time 0.821s (± 0.70%) 0.845s (± 1.15%) +0.024s (+ 2.96%) 0.821s 0.873s p=0.000 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 846,490 (± 0.09%) 847,503 (± 0.06%) +1,013 (+ 0.12%) 846,274 849,110 p=0.040 n=12
Types 249,940 (± 0.00%) 250,655 (± 0.00%) +715 (+ 0.29%) 250,653 250,656 p=0.000 n=12
Memory Used 789,538k (± 0.04%) 789,600k (± 0.05%) ~ 788,692k 790,698k p=0.876 n=12
Memory Allocs 12,861,275 (± 0.06%) 12,864,489 (± 0.05%) +3,213 (+ 0.02%) 12,856,994 12,894,081 p=0.020 n=12
Config Time 0.017s (± 1.70%) 0.017s (± 1.99%) ~ 0.016s 0.017s p=0.400 n=12
Parse Time 0.255s (± 2.89%) 0.258s (± 2.88%) ~ 0.236s 0.273s p=0.723 n=12
Bind Time 0.063s (±11.37%) 0.061s (± 6.43%) ~ 0.057s 0.079s p=0.989 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.597s (± 0.91%) 1.603s (± 1.19%) ~ 1.582s 1.687s p=0.325 n=12
Total Time 1.946s (± 1.01%) 1.952s (± 1.12%) ~ 1.919s 2.046s p=0.469 n=12
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=12
Symbols 4,351,480 5,312,770 🔻+961,290 (+22.09%) ~ ~ p=0.000 n=12
Types 1,380,970 1,304,778 🟩-76,192 (- 5.52%) ~ ~ p=0.000 n=12
Memory Used 2,974,309k (± 0.05%) 3,224,763k (± 0.06%) 🔻+250,454k (+ 8.42%) 3,219,075k 3,229,957k p=0.000 n=12
Memory Allocs 32,853,441 (± 0.09%) 35,809,705 (± 0.12%) 🔻+2,956,264 (+ 9.00%) 35,752,103 35,999,674 p=0.000 n=12
Config Time 0.017s (± 1.70%) 0.017s (± 1.45%) ~ 0.016s 0.017s p=1.000 n=12
Parse Time 0.498s (± 3.71%) 0.502s (± 2.44%) ~ 0.463s 0.533s p=0.966 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 8.475s (± 0.77%) 8.891s (± 0.58%) 🔻+0.416s (+ 4.91%) 8.712s 8.990s p=0.000 n=12
Emit Time 0.436s (± 3.41%) 0.464s (±12.78%) ~ 0.422s 0.695s p=0.311 n=12
Total Time 10.202s (± 0.45%) 10.635s (± 0.26%) 🔻+0.433s (+ 4.24%) 10.571s 10.697s p=0.000 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,390,229 1,390,684 +455 (+ 0.03%) ~ ~ p=0.000 n=12
Types 441,498 444,372 +2,874 (+ 0.65%) ~ ~ p=0.000 n=12
Memory Used 1,680,517k (± 0.86%) 1,679,775k (± 1.03%) ~ 1,653,583k 1,730,776k p=0.590 n=12
Memory Allocs 92,203,684 (± 0.13%) 92,067,189 (± 0.21%) ~ 91,605,193 92,431,410 p=0.410 n=12
Config Time 0.003s (± 8.75%) 0.003s (±16.58%) ~ 0.002s 0.005s p=0.545 n=12
Parse Time 0.196s (± 4.45%) 0.194s (± 4.30%) ~ 0.176s 0.213s p=0.755 n=12
Bind Time 0.000s (±217.90%) 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.797s (± 0.68%) 1.861s (± 0.60%) +0.064s (+ 3.56%) 1.828s 1.891s p=0.000 n=12
Emit Time 0.303s (± 5.64%) 0.283s (± 4.84%) ~ 0.248s 0.318s p=0.050 n=12
Total Time 23.464s (± 0.60%) 23.786s (± 0.61%) +0.323s (+ 1.38%) 23.479s 24.233s p=0.002 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 334,953 334,954 +1 (+ 0.00%) ~ ~ p=0.000 n=12
Types 197,616 199,254 +1,638 (+ 0.83%) ~ ~ p=0.000 n=12
Memory Used 313,293k (± 0.04%) 313,659k (± 0.08%) +366k (+ 0.12%) 313,355k 314,810k p=0.001 n=12
Memory Allocs 4,622,892 (± 0.01%) 4,625,754 (± 0.01%) +2,862 (+ 0.06%) 4,624,302 4,627,102 p=0.000 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.113s (± 5.11%) 0.117s (± 5.95%) ~ 0.101s 0.130s p=0.503 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.045s (± 0.36%) 1.080s (± 0.37%) +0.035s (+ 3.36%) 1.069s 1.091s p=0.000 n=12
Emit Time 0.132s (±12.20%) 0.127s (±12.41%) ~ 0.095s 0.160s p=0.898 n=12
Total Time 1.344s (± 1.02%) 1.378s (± 1.32%) +0.034s (+ 2.53%) 1.328s 1.426s p=0.005 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 303,834 304,077 +243 (+ 0.08%) ~ ~ p=0.000 n=12
Types 181,663 183,233 +1,570 (+ 0.86%) ~ ~ p=0.000 n=12
Memory Used 273,940k (± 0.02%) 274,145k (± 0.02%) +205k (+ 0.07%) 274,017k 274,288k p=0.000 n=12
Memory Allocs 1,615,911 (± 0.01%) 1,619,120 (± 0.01%) +3,209 (+ 0.20%) 1,618,899 1,619,382 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.099s (± 2.91%) 0.100s (± 4.22%) ~ 0.090s 0.109s p=0.701 n=12
Bind Time 0.038s (±14.34%) 0.036s (± 7.55%) ~ 0.031s 0.045s p=0.876 n=12
Check Time 0.818s (± 0.74%) 0.844s (± 0.44%) +0.026s (+ 3.24%) 0.830s 0.852s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.970s (± 0.82%) 0.995s (± 0.65%) +0.025s (+ 2.60%) 0.971s 1.008s p=0.000 n=12
vscode - native
Errors 380 380 ~ ~ ~ p=1.000 n=12
Symbols 10,769,312 10,784,116 +14,804 (+ 0.14%) ~ ~ p=0.000 n=12
Types 3,576,913 3,604,174 +27,261 (+ 0.76%) ~ ~ p=0.000 n=12
Memory Used 6,952,494k (± 0.02%) 6,955,318k (± 0.02%) +2,824k (+ 0.04%) 6,952,478k 6,958,771k p=0.001 n=12
Memory Allocs 53,281,584 (± 0.03%) 53,357,108 (± 0.06%) +75,523 (+ 0.14%) 53,326,648 53,474,593 p=0.000 n=12
Config Time 0.074s (± 0.42%) 0.073s (± 0.44%) ~ 0.073s 0.074s p=0.414 n=12
Parse Time 1.735s (± 3.30%) 1.818s (± 3.35%) ~ 1.659s 1.956s p=0.052 n=12
Bind Time 0.670s (±17.81%) 0.542s (±16.78%) ~ 0.434s 0.833s p=0.178 n=12
Check Time 13.887s (± 1.28%) 14.573s (± 1.05%) 🔻+0.687s (+ 4.95%) 14.207s 14.817s p=0.000 n=12
Emit Time 5.274s (± 8.88%) 5.007s (±10.71%) ~ 4.068s 6.214s p=0.478 n=12
Total Time 21.725s (± 1.71%) 22.097s (± 1.91%) ~ 21.339s 23.127s p=0.291 n=12
webpack - native
Errors 589 592 +3 (+ 0.51%) ~ ~ p=0.000 n=12
Symbols 1,298,687 1,300,616 +1,929 (+ 0.15%) ~ ~ p=0.000 n=12
Types 614,068 638,893 🔻+24,825 (+ 4.04%) ~ ~ p=0.000 n=12
Memory Used 1,003,966k (± 0.02%) 1,006,018k (± 0.02%) +2,052k (+ 0.20%) 1,005,482k 1,006,683k p=0.000 n=12
Memory Allocs 6,536,570 (± 0.01%) 6,604,938 (± 0.03%) +68,368 (+ 1.05%) 6,602,460 6,613,776 p=0.000 n=12
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.281s (± 2.55%) 0.287s (± 3.34%) ~ 0.264s 0.312s p=0.370 n=12
Bind Time 0.082s (±12.66%) 0.084s (±17.46%) ~ 0.063s 0.122s p=0.712 n=12
Check Time 2.060s (± 0.97%) 2.134s (± 0.72%) +0.074s (+ 3.59%) 2.094s 2.166s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 2.468s (± 0.85%) 2.549s (± 0.50%) +0.081s (+ 3.28%) 2.522s 2.586s p=0.000 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,055,167 1,055,698 +531 (+ 0.05%) ~ ~ p=0.000 n=12
Types 387,939 388,698 +759 (+ 0.20%) ~ ~ p=0.000 n=12
Memory Used 610,347k (± 0.02%) 610,559k (± 0.02%) +213k (+ 0.03%) 610,387k 610,872k p=0.005 n=12
Memory Allocs 4,878,314 (± 0.08%) 4,879,437 (± 0.08%) ~ 4,871,961 4,892,417 p=0.843 n=12
Config Time 0.003s 0.003s ~ ~ ~ p=1.000 n=12
Parse Time 0.144s (± 2.76%) 0.142s (± 4.47%) ~ 0.130s 0.162s p=0.353 n=12
Bind Time 0.043s (±16.22%) 0.050s (±19.47%) ~ 0.032s 0.070s p=0.311 n=12
Check Time 1.283s (± 0.72%) 1.329s (± 0.95%) +0.046s (+ 3.61%) 1.309s 1.372s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.480s (± 0.63%) 1.532s (± 0.77%) +0.052s (+ 3.51%) 1.508s 1.577s p=0.000 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@typescript-automation

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.

@jakebailey

Copy link
Copy Markdown
Member

The DT hang might be real? It's taking much longer?

@jakebailey

Copy link
Copy Markdown
Member

Multiple of the top / user tests are also hitting that.

@weswigham

Copy link
Copy Markdown
Member Author

I'll look into it before I remove the compat mapped type behavior and simplify the quickinfo to just the origin type.

@weswigham

Copy link
Copy Markdown
Member Author

Looks like just a reentrancy bug in the mapped type logic, which is going away anyway, simple fix then.

Comment thread tsc/internal/checker/relater.go Outdated
=== stringMappingReduction.ts ===
type T00 = "prop" | `p${Lowercase<string>}p`; // `p${Lowercase<string>}p`
>T00 : `p${Lowercase<string>}p`
>T00 : T00

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd how this turns into a self naming

function C2(transform: "-moz-initial" | (string & {})) { return 12; }
>C2 : (transform: "-moz-initial" | (string & {})) => number
>transform : "-moz-initial" | (string & {})
>transform : string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is happening because only hover shows the nice type, whereas the baselines show the real one

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - would you rather we show more details in .types? I can change it to print both, if we'd like.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the choice was to drop the special printing, I'm not sure it matters

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the choice was to print quickinfo as the origin type, meanwhile the baselines are still showing the actual type, so they do disagree. Imma make .types show both - no reason they can't be explicit.

@weswigham

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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

Command Status Results
test top400 ✅ Started 👀 Results
user test this ✅ Started ✅ Results
run dt ✅ Started 👀 Results
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown
Contributor

Hey Wesley Wigham (@weswigham), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: oojs-ui

Branch error:

Project scope: tsconfig.json

Error: /mnt/vss/_work/1/s/DefinitelyTyped/types/oojs-ui/oojs-ui-tests.ts:2426:5
TypeScript@local expected type to be:
  Record<string, Icon>
got:
  Record<string, string>

/mnt/vss/_work/1/s/DefinitelyTyped/types/oojs-ui/oojs-ui-tests.ts:2850:13
TypeScript@local expected type to be:
  Icon | Record<string, Icon> | undefined
got:
  string | Record<string, string> | undefined
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:204:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:196:20)
Branch only errors:

Package: react

Branch error:

Project scope: tsconfig.json

Error: /mnt/vss/_work/1/s/DefinitelyTyped/types/react/test/tsx.tsx:936:9
TypeScript@local compile error TS2578:
Unused '@ts-expect-error' directive.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:204:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:196:20)
Branch only errors:

Package: leaflet-pixi-overlay

Branch error:

Project scope: tsconfig.json

Error: /mnt/vss/_work/1/s/DefinitelyTyped/types/leaflet-pixi-overlay/leaflet-pixi-overlay-tests.ts:21:39
TypeScript@local compile error TS2345:
Argument of type 'Graphics' is not assignable to parameter of type 'DisplayObject'.
Types of property 'children' are incompatible.
Type 'DisplayObject[]' is not assignable to type 'readonly FederatedEventTarget[]'.
Type 'DisplayObject' is not assignable to type 'FederatedEventTarget'.
The types of 'parent.eventNames()' are incompatible between these types.
Type '(keyof DisplayObjectEvents)[]' is not assignable to type '(string | symbol)[]'.
Type 'keyof DisplayObjectEvents' is not assignable to type 'string | symbol'.
Type 'number' is not assignable to type 'string | symbol'.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:204:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:196:20)

Full output in the log.

@jakebailey

Jake Bailey (jakebailey) commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

RE: DT, if this is exposed over the API, theoretically I can make it prefer the new string, I think?

The other failures are interesting, though.

@typescript-automation

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing baseline and pr:

Everything looks good!

@typescript-automation

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,276 115,363 +87 (+ 0.08%) ~ ~ p=0.000 n=12
Types 79,613 80,044 +431 (+ 0.54%) ~ ~ p=0.000 n=12
Memory Used 139,436k (± 0.05%) 139,589k (± 0.05%) +153k (+ 0.11%) 139,445k 139,715k p=0.002 n=12
Memory Allocs 2,190,720 (± 0.00%) 2,191,591 (± 0.01%) +872 (+ 0.04%) 2,191,313 2,191,895 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.042s (± 4.14%) 0.040s (± 4.27%) ~ 0.037s 0.045s p=0.242 n=12
Bind Time 0.013s (±13.81%) 0.013s (±13.99%) ~ 0.010s 0.017s p=0.966 n=12
Check Time 0.495s (± 0.62%) 0.515s (± 0.80%) 🔻+0.020s (+ 4.02%) 0.504s 0.525s p=0.000 n=12
Emit Time 0.270s (± 2.77%) 0.279s (± 1.88%) ~ 0.268s 0.291s p=0.053 n=12
Total Time 0.827s (± 1.04%) 0.854s (± 0.71%) +0.028s (+ 3.37%) 0.836s 0.872s p=0.000 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 845,731 (± 0.09%) 846,037 (± 0.06%) ~ 844,618 846,948 p=0.630 n=12
Types 248,124 (± 0.00%) 248,877 (± 0.00%) +753 (+ 0.30%) 248,873 248,885 p=0.000 n=12
Memory Used 784,330k (± 0.03%) 784,498k (± 0.03%) ~ 783,842k 785,037k p=0.198 n=12
Memory Allocs 12,843,389 (± 0.06%) 12,843,055 (± 0.04%) ~ 12,839,173 12,867,940 p=0.114 n=12
Config Time 0.017s (± 1.86%) 0.016s (± 1.75%) ~ 0.016s 0.017s p=0.100 n=12
Parse Time 0.262s (± 3.11%) 0.253s (± 3.57%) ~ 0.226s 0.268s p=0.155 n=12
Bind Time 0.059s (± 2.44%) 0.075s (±20.95%) ~ 0.058s 0.121s p=0.214 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.596s (± 0.72%) 1.617s (± 1.46%) ~ 1.561s 1.667s p=0.164 n=12
Total Time 1.945s (± 0.54%) 1.974s (± 1.64%) ~ 1.912s 2.050s p=0.370 n=12
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=12
Symbols 4,359,614 4,332,811 -26,803 (- 0.61%) ~ ~ p=0.000 n=12
Types 1,376,379 1,297,429 🟩-78,950 (- 5.74%) ~ ~ p=0.000 n=12
Memory Used 2,955,794k (± 0.06%) 2,915,459k (± 0.06%) -40,334k (- 1.36%) 2,911,282k 2,919,612k p=0.000 n=12
Memory Allocs 32,858,559 (± 0.05%) 31,384,756 (± 0.04%) 🟩-1,473,802 (- 4.49%) 31,353,548 31,421,479 p=0.000 n=12
Config Time 0.017s (± 1.07%) 0.016s (± 1.97%) -0.001s (- 2.96%) 0.016s 0.017s p=0.027 n=12
Parse Time 0.501s (± 2.18%) 0.510s (± 1.84%) ~ 0.480s 0.530s p=0.193 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 8.621s (± 0.57%) 8.539s (± 0.34%) -0.082s (- 0.95%) 8.452s 8.640s p=0.001 n=12
Emit Time 0.547s (±15.07%) 0.451s (± 8.73%) 🟩-0.096s (-17.63%) 0.416s 0.600s p=0.021 n=12
Total Time 10.460s (± 0.63%) 10.275s (± 0.48%) -0.185s (- 1.77%) 10.123s 10.380s p=0.000 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,390,229 1,390,683 +454 (+ 0.03%) ~ ~ p=0.000 n=12
Types 441,498 444,370 +2,872 (+ 0.65%) ~ ~ p=0.000 n=12
Memory Used 1,689,878k (± 1.02%) 1,679,743k (± 0.99%) ~ 1,647,305k 1,720,676k p=0.443 n=12
Memory Allocs 92,168,203 (± 0.11%) 92,115,967 (± 0.16%) ~ 91,767,378 92,462,389 p=0.843 n=12
Config Time 0.003s (±14.26%) 0.003s (±14.59%) ~ 0.002s 0.004s p=0.874 n=12
Parse Time 0.196s (± 4.36%) 0.196s (± 4.80%) ~ 0.175s 0.224s p=0.899 n=12
Bind Time 0.000s (±217.90%) 0.000s (±217.90%) ~ 0.000s 0.001s p=1.000 n=12
Check Time 1.813s (± 0.55%) 1.856s (± 0.67%) +0.043s (+ 2.39%) 1.808s 1.879s p=0.000 n=12
Emit Time 0.291s (± 5.50%) 0.296s (± 3.76%) ~ 0.265s 0.316s p=0.434 n=12
Total Time 23.358s (± 0.58%) 23.932s (± 0.63%) +0.574s (+ 2.46%) 23.517s 24.265s p=0.000 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 334,953 334,954 +1 (+ 0.00%) ~ ~ p=0.000 n=12
Types 197,616 199,254 +1,638 (+ 0.83%) ~ ~ p=0.000 n=12
Memory Used 313,286k (± 0.03%) 313,459k (± 0.02%) +174k (+ 0.06%) 313,193k 313,622k p=0.014 n=12
Memory Allocs 4,623,441 (± 0.01%) 4,626,840 (± 0.01%) +3,400 (+ 0.07%) 4,625,983 4,627,762 p=0.000 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.118s (± 4.28%) 0.112s (± 4.40%) ~ 0.103s 0.126s p=0.053 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.052s (± 0.51%) 1.079s (± 0.64%) +0.027s (+ 2.56%) 1.061s 1.096s p=0.000 n=12
Emit Time 0.137s (±10.85%) 0.125s (±13.92%) ~ 0.093s 0.175s p=0.271 n=12
Total Time 1.358s (± 1.09%) 1.371s (± 0.97%) ~ 1.343s 1.421s p=0.173 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 303,834 304,077 +243 (+ 0.08%) ~ ~ p=0.000 n=12
Types 181,663 183,233 +1,570 (+ 0.86%) ~ ~ p=0.000 n=12
Memory Used 273,931k (± 0.03%) 274,172k (± 0.02%) +241k (+ 0.09%) 274,000k 274,318k p=0.000 n=12
Memory Allocs 1,615,905 (± 0.01%) 1,619,157 (± 0.02%) +3,252 (+ 0.20%) 1,618,405 1,619,564 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.101s (± 4.41%) 0.099s (± 4.87%) ~ 0.089s 0.112s p=0.417 n=12
Bind Time 0.038s (± 9.32%) 0.037s (± 9.73%) ~ 0.029s 0.048s p=0.504 n=12
Check Time 0.824s (± 0.66%) 0.845s (± 0.44%) +0.022s (+ 2.61%) 0.839s 0.856s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.978s (± 0.89%) 0.996s (± 0.66%) +0.018s (+ 1.84%) 0.980s 1.009s p=0.006 n=12
vscode - native
Errors 380 380 ~ ~ ~ p=1.000 n=12
Symbols 10,774,371 10,788,964 +14,593 (+ 0.14%) ~ ~ p=0.000 n=12
Types 3,574,763 3,601,843 +27,080 (+ 0.76%) ~ ~ p=0.000 n=12
Memory Used 6,973,810k (± 0.02%) 6,973,631k (± 0.02%) ~ 6,970,437k 6,977,381k p=0.514 n=12
Memory Allocs 53,434,851 (± 0.01%) 53,492,159 (± 0.01%) +57,307 (+ 0.11%) 53,485,891 53,504,086 p=0.000 n=12
Config Time 0.073s (± 0.44%) 0.073s (± 0.39%) ~ 0.073s 0.074s p=0.223 n=12
Parse Time 1.784s (± 3.58%) 1.799s (± 3.32%) ~ 1.676s 1.918s p=0.744 n=12
Bind Time 0.602s (±17.85%) 0.565s (±17.19%) ~ 0.438s 0.809s p=0.541 n=12
Check Time 13.944s (± 1.42%) 14.685s (± 1.20%) 🔻+0.741s (+ 5.32%) 14.208s 14.920s p=0.000 n=12
Emit Time 4.953s (±11.75%) 4.680s (±11.25%) ~ 4.050s 6.047s p=0.590 n=12
Total Time 21.441s (± 2.02%) 21.884s (± 1.84%) ~ 21.371s 22.939s p=0.128 n=12
webpack - native
Errors 589 589 ~ ~ ~ p=1.000 n=12
Symbols 1,297,374 1,299,063 +1,689 (+ 0.13%) ~ ~ p=0.000 n=12
Types 608,047 624,748 +16,701 (+ 2.75%) ~ ~ p=0.000 n=12
Memory Used 992,719k (± 0.01%) 994,512k (± 0.02%) +1,793k (+ 0.18%) 993,884k 994,872k p=0.000 n=12
Memory Allocs 6,482,716 (± 0.03%) 6,525,022 (± 0.03%) +42,306 (+ 0.65%) 6,522,636 6,531,232 p=0.000 n=12
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.292s (± 2.54%) 0.289s (± 3.72%) ~ 0.260s 0.310s p=0.723 n=12
Bind Time 0.075s (±12.38%) 0.082s (±18.98%) ~ 0.064s 0.130s p=0.701 n=12
Check Time 2.232s (± 0.68%) 2.305s (± 0.40%) +0.074s (+ 3.30%) 2.290s 2.334s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 2.642s (± 0.48%) 2.718s (± 0.62%) +0.076s (+ 2.86%) 2.691s 2.768s p=0.000 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,054,027 1,054,357 +330 (+ 0.03%) ~ ~ p=0.000 n=12
Types 387,065 387,810 +745 (+ 0.19%) ~ ~ p=0.000 n=12
Memory Used 611,350k (± 0.02%) 611,426k (± 0.02%) ~ 611,190k 611,851k p=0.347 n=12
Memory Allocs 4,865,618 (± 0.06%) 4,872,916 (± 0.12%) ~ 4,856,934 4,890,107 p=0.068 n=12
Config Time 0.003s 0.003s ~ ~ ~ p=1.000 n=12
Parse Time 0.144s (± 3.25%) 0.140s (± 3.27%) ~ 0.131s 0.151s p=0.247 n=12
Bind Time 0.042s (±20.50%) 0.047s (±19.94%) ~ 0.030s 0.069s p=0.515 n=12
Check Time 1.208s (± 0.71%) 1.245s (± 0.80%) +0.037s (+ 3.06%) 1.224s 1.285s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.405s (± 0.91%) 1.443s (± 0.92%) +0.038s (+ 2.67%) 1.412s 1.478s p=0.001 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@typescript-automation

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the top 400 repos with tsc comparing baseline and pr:

Something interesting changed - please have a look.

Details

facebook/lexical

15 of 35 projects failed to build with the old tsc and were ignored

tsconfig.build.json

dev-examples/mdast-editor/tsconfig.json

dev-examples/dom-import/tsconfig.json

pixijs/pixijs

1 of 3 projects failed to build with the old tsc and were ignored

playground/tsconfig.json

examples/tsconfig.json

SBoudrias/Inquirer.js

tsconfig.json

packages/testing/tsconfig.json

packages/select/tsconfig.json

packages/search/tsconfig.json

packages/rawlist/tsconfig.json

packages/prompts/tsconfig.json

packages/password/tsconfig.json

packages/number/tsconfig.json

packages/inquirer/tsconfig.json

packages/input/tsconfig.json

packages/i18n/tsconfig.json

packages/expand/tsconfig.json

packages/editor/tsconfig.json

packages/demo/tsconfig.json

packages/core/tsconfig.json

packages/confirm/tsconfig.json

packages/checkbox/tsconfig.json

vercel/ai

9 of 91 projects failed to build with the old tsc and were ignored

packages/moonshotai/tsconfig.build.json

  • error TS2344: Type '"kimi-k2.5" | "kimi-k2.6" | "kimi-k2.7-code" | "kimi-k2.7-code-highspeed" | "kimi-k3" | "moonshot-v1-128k" | "moonshot-v1-128k-vision-preview" | "moonshot-v1-32k" | "moonshot-v1-32k-vision-preview" | "moonshot-v1-8k" | "moonshot-v1-8k-vision-preview" | "moonshot-v1-auto"' does not satisfy the constraint '"Expected: literal string: kimi-k2.5, Actual: never" | "Expected: literal string: kimi-k2.6, Actual: never" | "Expected: literal string: kimi-k2.7-code, Actual: never" | ... 8 more ... | "Expected: literal string: moonshot-v1-auto, Actual: never"'.

packages/deepseek/tsconfig.build.json

  • error TS2344: Type '"deepseek-flash" | "deepseek-v4-flash" | "deepseek-v4-flash-vision-exp" | "deepseek-v4-pro"' does not satisfy the constraint '"Expected: literal string: deepseek-flash, Actual: never" | "Expected: literal string: deepseek-v4-flash, Actual: never" | "Expected: literal string: deepseek-v4-flash-vision-exp, Actual: never" | "Expected: literal string: deepseek-v4-pro, Actual: never"'.

This branch has not been deployed

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

Labels

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

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

3 participants