Skip to content

Computed names in declarations files are resolved even when non-literal, preserve computed names when expressions are entity names - #60052

Merged
Wesley Wigham (weswigham) merged 11 commits into
microsoft:mainfrom
weswigham:computed-names-in-declarations-files-are-resolved
Jan 24, 2025
Merged

Computed names in declarations files are resolved even when non-literal, preserve computed names when expressions are entity names#60052
Wesley Wigham (weswigham) merged 11 commits into
microsoft:mainfrom
weswigham:computed-names-in-declarations-files-are-resolved

Conversation

@weswigham

Copy link
Copy Markdown
Member

This PR basically removes the grammar error requiring computed names in declaration files/other contexts resolve to literal types, and allows them to resolve to whatever so long as they're an entity name expression (a.b.c), and endeavors in declaration emit to preserve those input computed names that imply index signatures wherever possible. This clears the way for isolatedDeclarations to allow always emitting a computed property name on the output for a computed property name on the input, so long as the expression is an entity name expression.

@weswigham

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 24, 2024

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

@typescript-bot

Copy link
Copy Markdown
Contributor

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure Daniel Rosenwasser (@DanielRosenwasser) and Ryan Cavanaugh (@RyanCavanaugh) are aware of the changes, just as a heads up.

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.base.json

packages/schema/dtslint/tsconfig.json

@typescript-bot

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
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,34062,340~~~p=1.000 n=6
Types50,37850,378~~~p=1.000 n=6
Memory used193,214k (± 0.82%)195,011k (± 0.98%)~192,422k196,310kp=0.298 n=6
Parse Time1.93s (± 0.89%)1.96s (± 0.42%)+0.03s (+ 1.64%)1.95s1.97sp=0.006 n=6
Bind Time1.05s (± 0.79%)1.07s (± 0.98%)~1.05s1.08sp=0.122 n=6
Check Time13.98s (± 0.48%)13.97s (± 0.27%)~13.91s14.00sp=0.872 n=6
Emit Time4.09s (± 4.96%)4.04s (± 3.26%)~3.97s4.31sp=0.572 n=6
Total Time21.05s (± 0.79%)21.03s (± 0.54%)~20.94s21.25sp=0.686 n=6
angular-1 - node (v18.15.0, x64)
Errors77~~~p=1.000 n=6
Symbols947,102947,102~~~p=1.000 n=6
Types410,738410,738~~~p=1.000 n=6
Memory used1,224,040k (± 0.00%)1,224,060k (± 0.00%)~1,224,033k1,224,144kp=0.689 n=6
Parse Time6.62s (± 0.57%)6.61s (± 0.67%)~6.56s6.69sp=0.688 n=6
Bind Time1.87s (± 0.22%)1.87s (± 0.40%)~1.86s1.88sp=1.000 n=6
Check Time31.30s (± 0.25%)31.41s (± 0.34%)~31.27s31.56sp=0.064 n=6
Emit Time15.05s (± 0.41%)15.03s (± 0.28%)~14.98s15.07sp=0.288 n=6
Total Time54.84s (± 0.25%)54.93s (± 0.31%)~54.68s55.14sp=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,521,6512,521,652+1 (+ 0.00%)~~p=0.001 n=6
Types936,037936,038+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,351,731k (± 0.00%)2,351,955k (± 0.00%)+224k (+ 0.01%)2,351,914k2,351,986kp=0.005 n=6
Parse Time9.29s (± 0.33%)9.29s (± 0.22%)~9.26s9.32sp=0.871 n=6
Bind Time2.14s (± 0.35%)2.14s (± 0.55%)~2.12s2.15sp=0.933 n=6
Check Time73.26s (± 0.29%)73.48s (± 0.76%)~73.00s74.46sp=0.689 n=6
Emit Time0.28s (± 3.19%)0.27s (± 3.31%)~0.26s0.28sp=0.113 n=6
Total Time84.97s (± 0.27%)85.17s (± 0.66%)~84.68s86.18sp=0.688 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,250,0561,250,396+340 (+ 0.03%)~~p=0.001 n=6
Types264,970265,020+50 (+ 0.02%)~~p=0.001 n=6
Memory used2,404,455k (± 0.03%)2,405,163k (± 0.03%)+708k (+ 0.03%)2,404,332k2,405,839kp=0.045 n=6
Parse Time5.12s (± 0.51%)5.12s (± 0.43%)~5.08s5.14sp=1.000 n=6
Bind Time1.90s (± 0.47%)1.91s (± 0.39%)~1.90s1.92sp=0.149 n=6
Check Time34.91s (± 0.30%)34.95s (± 0.37%)~34.70s35.07sp=0.422 n=6
Emit Time3.02s (± 3.84%)2.99s (± 0.89%)~2.95s3.03sp=0.748 n=6
Total Time44.97s (± 0.45%)44.98s (± 0.33%)~44.70s45.11sp=0.298 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,250,0561,250,396+340 (+ 0.03%)~~p=0.001 n=6
Types264,970265,020+50 (+ 0.02%)~~p=0.001 n=6
Memory used2,478,660k (± 0.02%)2,479,162k (± 0.02%)~2,478,578k2,480,282kp=0.093 n=6
Parse Time6.37s (± 0.30%)6.35s (± 0.94%)~6.25s6.41sp=1.000 n=6
Bind Time2.05s (± 0.57%)2.06s (± 0.60%)~2.04s2.07sp=0.625 n=6
Check Time41.61s (± 0.92%)41.82s (± 0.83%)~41.44s42.19sp=0.298 n=6
Emit Time3.58s (± 1.28%)3.67s (± 3.57%)~3.51s3.85sp=0.173 n=6
Total Time53.63s (± 0.71%)53.92s (± 0.58%)~53.50s54.21sp=0.128 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols260,936261,221+285 (+ 0.11%)~~p=0.001 n=6
Types106,385106,435+50 (+ 0.05%)~~p=0.001 n=6
Memory used436,588k (± 0.03%)436,904k (± 0.01%)+316k (+ 0.07%)436,835k436,951kp=0.005 n=6
Parse Time2.85s (± 0.31%)2.86s (± 0.97%)~2.83s2.90sp=0.683 n=6
Bind Time1.08s (± 1.43%)1.07s (± 1.40%)~1.06s1.09sp=0.423 n=6
Check Time15.37s (± 0.35%)15.46s (± 0.25%)+0.09s (+ 0.56%)15.39s15.51sp=0.020 n=6
Emit Time1.28s (± 1.45%)1.29s (± 1.61%)~1.26s1.32sp=0.744 n=6
Total Time20.58s (± 0.30%)20.68s (± 0.36%)~20.56s20.75sp=0.065 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors6868~~~p=1.000 n=6
Symbols225,916225,916~~~p=1.000 n=6
Types94,41494,414~~~p=1.000 n=6
Memory used370,841k (± 0.02%)370,962k (± 0.02%)+121k (+ 0.03%)370,873k371,066kp=0.013 n=6
Parse Time2.76s (± 1.24%)2.79s (± 0.67%)~2.76s2.81sp=0.259 n=6
Bind Time1.57s (± 1.38%)1.58s (± 1.06%)~1.56s1.60sp=0.463 n=6
Check Time15.78s (± 0.40%)15.77s (± 0.22%)~15.73s15.82sp=0.467 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.11s (± 0.44%)20.14s (± 0.12%)~20.12s20.18sp=0.872 n=6
vscode - node (v18.15.0, x64)
Errors11~~~p=1.000 n=6
Symbols3,099,7753,099,775~~~p=1.000 n=6
Types1,068,9731,068,973~~~p=1.000 n=6
Memory used3,196,811k (± 0.00%)3,197,123k (± 0.00%)+312k (+ 0.01%)3,197,050k3,197,255kp=0.005 n=6
Parse Time17.20s (± 0.22%)17.23s (± 0.41%)~17.17s17.37sp=0.332 n=6
Bind Time5.42s (± 2.44%)5.39s (± 2.61%)~5.27s5.58sp=0.936 n=6
Check Time100.10s (± 0.42%)100.11s (± 0.39%)~99.73s100.78sp=1.000 n=6
Emit Time27.43s (± 0.72%)27.45s (± 0.48%)~27.31s27.67sp=0.689 n=6
Total Time150.15s (± 0.33%)150.18s (± 0.39%)~149.55s151.03sp=0.689 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols278,920278,920~~~p=1.000 n=6
Types113,837113,837~~~p=1.000 n=6
Memory used428,349k (± 0.02%)428,371k (± 0.02%)~428,277k428,542kp=0.936 n=6
Parse Time3.95s (± 0.44%)3.94s (± 0.31%)~3.93s3.96sp=0.622 n=6
Bind Time1.72s (± 0.52%)1.72s (± 0.57%)~1.71s1.73sp=0.798 n=6
Check Time17.69s (± 0.24%)17.61s (± 0.39%)~17.54s17.72sp=0.065 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time23.36s (± 0.18%)23.28s (± 0.32%)~23.19s23.39sp=0.073 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols540,027540,027~~~p=1.000 n=6
Types181,292181,292~~~p=1.000 n=6
Memory used483,548k (± 0.01%)483,586k (± 0.01%)~483,525k483,677kp=0.298 n=6
Parse Time4.02s (± 0.52%)4.01s (± 0.37%)~3.99s4.03sp=0.514 n=6
Bind Time1.42s (± 1.45%)1.43s (± 0.53%)~1.42s1.44sp=0.935 n=6
Check Time22.90s (± 0.55%)22.91s (± 0.36%)~22.79s23.04sp=0.873 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time28.35s (± 0.43%)28.35s (± 0.29%)~28.25s28.50sp=1.000 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

Wesley Wigham (@weswigham) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

alibaba/lowcode-engine

40 of 42 projects failed to build with the old tsc and were ignored

modules/code-generator/tsconfig.json

FormidableLabs/victory

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

packages/victory-axis/tsconfig.json

packages/victory-axis/tsconfig.build.json

tinacms/tinacms

13 of 25 projects failed to build with the old tsc and were ignored

packages/@tinacms/schema-tools/tsconfig.json

packages/@tinacms/graphql/tsconfig.json

packages/@tinacms/cli/tsconfig.json

tusen-ai/naive-ui

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

src/tsconfig.demo.json

vuetifyjs/vuetify

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

packages/vuetify/tsconfig.json

packages/vuetify/tsconfig.dist.json

packages/vuetify/tsconfig.checks.json

@MichaelMitchell-at

michaelm (MichaelMitchell-at) commented Sep 25, 2024

Copy link
Copy Markdown
Contributor

Amazing! Has the team already discussed the intent to ship this feature or is this only an experiment? Asking because I'm wondering if https://github.com/oxc-project/oxc/tree/main/crates/oxc_isolated_declarations could bypass the need to implement something like #58771 (oxc-project/oxc#4016) and implement the behavior in this PR directly.

@weswigham

Copy link
Copy Markdown
MemberAuthor

You can't ship this before we do because it produces declaration files that can't be correctly read by current versions of TS 😉

@weswigham
Wesley Wigham (weswigham)force-pushed the computed-names-in-declarations-files-are-resolved branch from 7fec56c to 22c5c89CompareOctober 1, 2024 17:31
@weswigham
Wesley Wigham (weswigham)force-pushed the computed-names-in-declarations-files-are-resolved branch from f1fcd56 to 587f9e0CompareOctober 1, 2024 17:58
@weswigham

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 1, 2024

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

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.base.json

packages/schema/dtslint/tsconfig.json

@typescript-bot

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
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3131~~~p=1.000 n=6
Symbols62,34062,340~~~p=1.000 n=6
Types50,37950,379~~~p=1.000 n=6
Memory used193,378k (± 0.73%)192,924k (± 0.09%)~192,779k193,152kp=0.471 n=6
Parse Time1.31s (± 0.57%)1.31s (± 0.57%)~1.30s1.32sp=1.000 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.75s (± 0.53%)9.74s (± 0.25%)~9.71s9.78sp=0.872 n=6
Emit Time2.72s (± 0.59%)2.73s (± 0.51%)~2.70s2.74sp=0.315 n=6
Total Time14.50s (± 0.35%)14.50s (± 0.18%)~14.46s14.53sp=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors3333~~~p=1.000 n=6
Symbols947,886947,886~~~p=1.000 n=6
Types410,840410,840~~~p=1.000 n=6
Memory used1,224,800k (± 0.01%)1,224,879k (± 0.00%)+78k (+ 0.01%)1,224,780k1,224,952kp=0.031 n=6
Parse Time8.05s (± 0.83%)8.06s (± 0.86%)~7.97s8.16sp=0.810 n=6
Bind Time2.26s (± 0.72%)2.27s (± 1.24%)~2.24s2.32sp=0.739 n=6
Check Time37.72s (± 0.43%)37.62s (± 0.41%)~37.39s37.79sp=0.296 n=6
Emit Time18.08s (± 0.82%)18.17s (± 0.42%)~18.09s18.25sp=0.468 n=6
Total Time66.11s (± 0.24%)66.11s (± 0.22%)~65.89s66.27sp=0.873 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,522,0382,522,038~~~p=1.000 n=6
Types936,053936,053~~~p=1.000 n=6
Memory used2,352,501k (± 0.00%)2,352,657k (± 0.00%)+156k (+ 0.01%)2,352,576k2,352,706kp=0.005 n=6
Parse Time9.37s (± 0.23%)9.33s (± 0.25%)-0.04s (- 0.46%)9.29s9.36sp=0.014 n=6
Bind Time2.16s (± 0.24%)2.16s (± 0.29%)~2.15s2.17sp=0.386 n=6
Check Time75.87s (± 0.27%)75.65s (± 0.17%)~75.49s75.79sp=0.066 n=6
Emit Time0.28s (± 2.95%)0.28s (± 2.26%)~0.27s0.29sp=0.432 n=6
Total Time87.67s (± 0.23%)87.41s (± 0.15%)~87.26s87.54sp=0.066 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,258,1061,258,459+353 (+ 0.03%)~~p=0.001 n=6
Types266,266266,354+88 (+ 0.03%)~~p=0.001 n=6
Memory used3,146,790k (± 0.03%)3,146,909k (± 0.02%)~3,146,389k3,147,720kp=1.000 n=6
Parse Time6.59s (± 0.55%)6.59s (± 0.54%)~6.54s6.63sp=0.810 n=6
Bind Time2.35s (± 0.73%)2.34s (± 1.82%)~2.28s2.41sp=0.468 n=6
Check Time43.00s (± 0.25%)43.08s (± 0.33%)~42.86s43.28sp=0.378 n=6
Emit Time3.51s (± 2.00%)3.52s (± 1.40%)~3.45s3.60sp=0.936 n=6
Total Time55.45s (± 0.31%)55.54s (± 0.31%)~55.27s55.79sp=0.471 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,258,1061,258,459+353 (+ 0.03%)~~p=0.001 n=6
Types266,266266,354+88 (+ 0.03%)~~p=0.001 n=6
Memory used2,496,029k (± 0.01%)2,496,975k (± 0.01%)+946k (+ 0.04%)2,496,399k2,497,391kp=0.008 n=6
Parse Time5.41s (± 0.54%)5.37s (± 1.00%)~5.32s5.47sp=0.107 n=6
Bind Time1.74s (± 0.48%)1.74s (± 0.32%)~1.73s1.74sp=0.855 n=6
Check Time35.83s (± 0.20%)35.82s (± 0.16%)~35.75s35.92sp=0.810 n=6
Emit Time3.05s (± 1.10%)3.05s (± 2.13%)~2.93s3.12sp=1.000 n=6
Total Time46.03s (± 0.21%)45.98s (± 0.27%)~45.91s46.23sp=0.378 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols261,785262,083+298 (+ 0.11%)~~p=0.001 n=6
Types106,508106,596+88 (+ 0.08%)~~p=0.001 n=6
Memory used438,475k (± 0.01%)438,838k (± 0.01%)+363k (+ 0.08%)438,803k438,875kp=0.005 n=6
Parse Time2.90s (± 0.42%)2.88s (± 0.42%)~2.87s2.90sp=0.138 n=6
Bind Time1.10s1.10s~~~p=1.000 n=6
Check Time15.71s (± 0.25%)15.72s (± 0.27%)~15.66s15.78sp=0.809 n=6
Emit Time1.31s (± 1.31%)1.32s (± 0.96%)~1.31s1.34sp=0.359 n=6
Total Time21.02s (± 0.22%)21.03s (± 0.19%)~20.98s21.07sp=0.809 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors6868~~~p=1.000 n=6
Symbols225,919225,919~~~p=1.000 n=6
Types94,41594,415~~~p=1.000 n=6
Memory used371,091k (± 0.02%)371,081k (± 0.01%)~371,048k371,129kp=0.575 n=6
Parse Time2.88s (± 1.13%)2.90s (± 0.55%)~2.89s2.93sp=0.224 n=6
Bind Time1.60s (± 1.84%)1.58s (± 0.89%)~1.56s1.60sp=0.258 n=6
Check Time16.32s (± 0.24%)16.30s (± 0.28%)~16.25s16.38sp=0.573 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.80s (± 0.37%)20.79s (± 0.20%)~20.74s20.85sp=1.000 n=6
vscode - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols3,110,2993,110,299~~~p=1.000 n=6
Types1,072,1791,072,179~~~p=1.000 n=6
Memory used3,202,479k (± 0.01%)3,203,049k (± 0.00%)+570k (+ 0.02%)3,202,916k3,203,338kp=0.005 n=6
Parse Time14.02s (± 0.33%)14.02s (± 0.45%)~13.94s14.09sp=0.872 n=6
Bind Time4.44s (± 0.44%)4.43s (± 0.24%)~4.42s4.45sp=0.871 n=6
Check Time85.29s (± 1.42%)86.61s (± 3.30%)~84.75s92.09sp=0.575 n=6
Emit Time24.92s (± 9.42%)24.08s (± 9.10%)~22.53s26.93sp=0.377 n=6
Total Time128.67s (± 2.09%)129.14s (± 2.74%)~125.83s133.40sp=0.936 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols279,484279,484~~~p=1.000 n=6
Types114,024114,024~~~p=1.000 n=6
Memory used429,365k (± 0.03%)429,460k (± 0.04%)~429,295k429,739kp=0.230 n=6
Parse Time5.02s (± 0.98%)5.06s (± 0.44%)~5.04s5.10sp=0.225 n=6
Bind Time2.14s (± 1.56%)2.15s (± 1.28%)~2.12s2.19sp=0.746 n=6
Check Time22.47s (± 0.56%)22.48s (± 0.54%)~22.35s22.63sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time29.64s (± 0.30%)29.70s (± 0.42%)~29.53s29.85sp=0.572 n=6
xstate-main - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols540,560540,560~~~p=1.000 n=6
Types181,448181,448~~~p=1.000 n=6
Memory used484,360k (± 0.01%)484,386k (± 0.01%)~484,284k484,461kp=0.298 n=6
Parse Time3.36s (± 0.72%)3.37s (± 0.56%)~3.34s3.39sp=0.571 n=6
Bind Time1.18s (± 0.89%)1.18s (± 1.16%)~1.16s1.19sp=0.804 n=6
Check Time19.12s (± 0.40%)19.04s (± 0.27%)~18.97s19.10sp=0.091 n=6
Emit Time0.00s (±244.70%)0.00s~~~p=0.405 n=6
Total Time23.66s (± 0.25%)23.59s (± 0.22%)~23.51s23.65sp=0.125 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

@weswigham

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 1, 2024

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

@typescript-bot

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.base.json

packages/schema/dtslint/tsconfig.json

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Everything looks the same!

You can check the log here.

@typescript-bot

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
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3131~~~p=1.000 n=6
Symbols62,34062,340~~~p=1.000 n=6
Types50,37950,379~~~p=1.000 n=6
Memory used194,035k (± 0.98%)193,440k (± 0.74%)~192,753k196,365kp=0.575 n=6
Parse Time1.32s (± 0.48%)1.30s (± 0.97%)-0.02s (- 1.52%)1.29s1.32sp=0.019 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.73s (± 0.28%)9.73s (± 0.26%)~9.69s9.77sp=0.566 n=6
Emit Time2.73s (± 0.59%)2.71s (± 1.15%)~2.66s2.75sp=0.191 n=6
Total Time14.50s (± 0.31%)14.46s (± 0.27%)~14.41s14.50sp=0.125 n=6
angular-1 - node (v18.15.0, x64)
Errors3333~~~p=1.000 n=6
Symbols947,886947,886~~~p=1.000 n=6
Types410,840410,840~~~p=1.000 n=6
Memory used1,224,561k (± 0.00%)1,224,687k (± 0.00%)+126k (+ 0.01%)1,224,644k1,224,743kp=0.005 n=6
Parse Time6.66s (± 0.89%)6.63s (± 0.83%)~6.55s6.69sp=0.514 n=6
Bind Time1.89s (± 0.44%)1.88s (± 0.29%)~1.88s1.89sp=0.855 n=6
Check Time31.81s (± 0.38%)31.86s (± 0.15%)~31.77s31.91sp=0.377 n=6
Emit Time15.21s (± 0.88%)15.18s (± 0.40%)~15.10s15.26sp=1.000 n=6
Total Time55.56s (± 0.45%)55.56s (± 0.17%)~55.40s55.65sp=0.575 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,522,0382,522,038~~~p=1.000 n=6
Types936,053936,053~~~p=1.000 n=6
Memory used2,352,496k (± 0.00%)2,352,669k (± 0.00%)+173k (+ 0.01%)2,352,612k2,352,740kp=0.005 n=6
Parse Time9.37s (± 0.55%)9.35s (± 0.30%)~9.30s9.37sp=0.517 n=6
Bind Time2.17s (± 0.41%)2.16s (± 0.65%)~2.14s2.18sp=0.215 n=6
Check Time76.04s (± 0.38%)76.14s (± 0.26%)~75.79s76.35sp=0.575 n=6
Emit Time0.28s0.28s (± 1.47%)~0.27s0.28sp=0.405 n=6
Total Time87.86s (± 0.36%)87.92s (± 0.23%)~87.57s88.17sp=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,258,1061,258,500+394 (+ 0.03%)~~p=0.001 n=6
Types266,266266,376+110 (+ 0.04%)~~p=0.001 n=6
Memory used2,422,532k (± 0.01%)2,423,377k (± 0.02%)+845k (+ 0.03%)2,423,035k2,424,182kp=0.005 n=6
Parse Time5.20s (± 0.89%)5.20s (± 0.76%)~5.14s5.24sp=0.748 n=6
Bind Time1.93s (± 0.39%)1.93s (± 0.72%)~1.91s1.94sp=0.740 n=6
Check Time35.52s (± 0.28%)35.37s (± 0.34%)~35.21s35.52sp=0.054 n=6
Emit Time3.01s (± 1.85%)3.02s (± 0.71%)~2.98s3.04sp=1.000 n=6
Total Time45.68s (± 0.15%)45.52s (± 0.26%)-0.16s (- 0.34%)45.35s45.64sp=0.020 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,258,1061,258,500+394 (+ 0.03%)~~p=0.001 n=6
Types266,266266,376+110 (+ 0.04%)~~p=0.001 n=6
Memory used2,859,100k (±13.77%)2,766,705k (±12.90%)~2,499,732k3,222,096kp=0.689 n=6
Parse Time6.72s (± 2.99%)6.63s (± 2.17%)~6.47s6.89sp=0.748 n=6
Bind Time2.14s (± 1.99%)2.19s (± 3.98%)~2.11s2.36sp=0.336 n=6
Check Time43.19s (± 0.48%)43.07s (± 0.40%)~42.81s43.33sp=0.471 n=6
Emit Time3.57s (± 2.43%)3.49s (± 1.70%)~3.41s3.59sp=0.173 n=6
Total Time55.63s (± 0.46%)55.39s (± 0.29%)~55.20s55.65sp=0.128 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols261,785262,124+339 (+ 0.13%)~~p=0.001 n=6
Types106,508106,618+110 (+ 0.10%)~~p=0.001 n=6
Memory used438,789k (± 0.01%)439,077k (± 0.01%)+288k (+ 0.07%)439,040k439,137kp=0.005 n=6
Parse Time3.54s (± 0.67%)3.54s (± 1.41%)~3.48s3.63sp=0.809 n=6
Bind Time1.31s (± 0.89%)1.32s (± 1.12%)~1.30s1.33sp=0.219 n=6
Check Time18.94s (± 0.42%)18.84s (± 0.36%)~18.72s18.92sp=0.064 n=6
Emit Time1.55s (± 1.27%)1.54s (± 1.26%)~1.52s1.57sp=0.466 n=6
Total Time25.33s (± 0.40%)25.24s (± 0.24%)~25.14s25.31sp=0.172 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors6868~~~p=1.000 n=6
Symbols225,919225,919~~~p=1.000 n=6
Types94,41594,415~~~p=1.000 n=6
Memory used371,077k (± 0.01%)371,092k (± 0.01%)~371,027k371,165kp=0.630 n=6
Parse Time3.59s (± 1.59%)3.62s (± 1.41%)~3.52s3.66sp=0.260 n=6
Bind Time1.96s (± 1.66%)1.96s (± 0.95%)~1.93s1.98sp=1.000 n=6
Check Time20.27s (± 0.28%)20.31s (± 0.32%)~20.24s20.41sp=0.145 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time25.82s (± 0.25%)25.88s (± 0.29%)~25.78s25.97sp=0.227 n=6
vscode - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols3,110,4593,110,459~~~p=1.000 n=6
Types1,072,2261,072,226~~~p=1.000 n=6
Memory used3,202,640k (± 0.01%)3,203,131k (± 0.00%)+491k (+ 0.02%)3,202,948k3,203,256kp=0.008 n=6
Parse Time14.10s (± 0.70%)14.00s (± 0.28%)~13.94s14.05sp=0.077 n=6
Bind Time4.44s (± 0.23%)4.43s (± 0.26%)~4.41s4.44sp=0.491 n=6
Check Time86.30s (± 1.71%)85.42s (± 1.41%)~84.13s87.72sp=0.173 n=6
Emit Time24.62s (± 8.98%)23.45s (± 7.52%)~22.60s27.04sp=0.471 n=6
Total Time129.44s (± 2.70%)127.31s (± 2.30%)~125.26s133.20sp=0.093 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols279,484279,484~~~p=1.000 n=6
Types114,024114,024~~~p=1.000 n=6
Memory used429,471k (± 0.03%)429,554k (± 0.02%)~429,430k429,687kp=0.230 n=6
Parse Time4.07s (± 0.36%)4.06s (± 0.93%)~3.99s4.09sp=0.806 n=6
Bind Time1.74s (± 0.63%)1.73s (± 1.69%)~1.69s1.78sp=0.319 n=6
Check Time18.11s (± 0.58%)18.21s (± 0.23%)~18.13s18.25sp=0.197 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time23.92s (± 0.41%)23.99s (± 0.29%)~23.90s24.08sp=0.199 n=6
xstate-main - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols540,560540,560~~~p=1.000 n=6
Types181,448181,448~~~p=1.000 n=6
Memory used484,316k (± 0.01%)484,365k (± 0.01%)~484,311k484,418kp=0.066 n=6
Parse Time3.35s (± 0.74%)3.35s (± 1.09%)~3.31s3.41sp=0.934 n=6
Bind Time1.17s (± 0.84%)1.18s (± 1.03%)~1.17s1.20sp=0.734 n=6
Check Time19.05s (± 0.28%)19.06s (± 0.39%)~18.99s19.18sp=0.872 n=6
Emit Time0.00s (±244.70%)0.00s~~~p=0.405 n=6
Total Time23.57s (± 0.26%)23.59s (± 0.29%)~23.48s23.67sp=0.689 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

Wesley Wigham (@weswigham) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

alibaba/lowcode-engine

40 of 42 projects failed to build with the old tsc and were ignored

modules/code-generator/tsconfig.json

1 similar comment
@typescript-bot

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/60052/merge:

Something interesting changed - please have a look.

Details

alibaba/lowcode-engine

40 of 42 projects failed to build with the old tsc and were ignored

modules/code-generator/tsconfig.json

@dragomirtitian

Copy link
Copy Markdown
Contributor

Computed properties that have a computed name of a literal type seem to be duplicated when another computed property that is not a literal type is present:

// index.tsdeclareconstx: string;declareconsty: "y";exportclassTest{[x]=10;[y]=10;}// index.d.tsdeclareconstx: string;declareconsty: "y";exportdeclareclassTest{[x]: number;[y]: number;[y]: number;// ❌}export{};

@jakebailey

Copy link
Copy Markdown
Member

Does this definitely fix #60818?

@weswigham

Copy link
Copy Markdown
MemberAuthor

Not intentionally, since it's only a.b.c style names this PR special-cases to copy through to declaration emit, but the late bound index signature logic may be generic enough to at least remove the index error and make an indexer on the resulting type, rather than not and issuing an error. Though it'd obviously be better if the element access behaved more like the equivalent dotted name and produced a concrete property, which is what I'd say the "real fix" aughta be.

TypeScript Bot (@typescript-bot) pack this

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
pack this✅ Started✅ Results

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

Hey Wesley Wigham (@weswigham), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/164590/artifacts?artifactName=tgz&fileId=F6ABB72746FFE8FA00220E3BDB1DD1A1944C2317AEEF5C0C73BAC8C6962134A102&fileName=/typescript-5.8.0-insiders.20250121.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.8.0-pr-60052-36".;

@jakebailey

Jake Bailey (jakebailey) commented Jan 21, 2025

Copy link
Copy Markdown
Member

I think this does what it should, but what's our strategy for dealing with the fact that this PR will cause index expressions to be emitted in such a way that TS<5.8 will be unable to read them?

Is this break acceptable? I think it has to be, because we really want to do it, but it seems like we're going to have to be really clear in the blog post to people that the types may have to be downleveled somehow...

Daniel Rosenwasser (@DanielRosenwasser)

Concretely, before:

declareclassBase1{[x: string]: ()=>void;}

After:

declareletprop: string;declareclassBase1{[prop]: ()=>void;}

@weswigham

Copy link
Copy Markdown
MemberAuthor

Is this break acceptable? I think it has to be, because we really want to do it, but it seems like we're going to have to be really clear in the blog post to people that the types may have to be downleveled somehow

Yeah. Wouldn't be the first time. It's also notable that while you do have to downlevel the declaration to inline the computed name's type to remove the A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. error in old versions of TS, it actually does still typecheck as expected despite the error in TS 5.7, thanks to the existing index signature work. So there's a tiny bit of versioning grace there, at least.

@RyanCavanaugh

Copy link
Copy Markdown
Member

What's the minimal input file that would cause a freshly-generated .d.ts file to not be readable by 5.7?

@jakebailey

Copy link
Copy Markdown
Member

In testing this, I think I found a bug:

letprop!: string;exportclassBase1{[x: string]: ()=>void;[prop]!: ()=>void;}exportclassBase2{[prop]!: ()=>void;[x: string]: ()=>void;}

Playground Link

The d.ts emit for this after the PR is:

exportdeclareclassBase1{[x: string]: ()=>void;}exportdeclareclassBase2{[x: string]: ()=>void;}

But, we can't know without type analysis that the computed property is safe to drop, and the emitter can't make that decision based on whether or not isolatedDeclarations is enabled (and those kinds of emitters would preserve both).

@weswigham

Copy link
Copy Markdown
MemberAuthor

What's the minimal input file that would cause a freshly-generated .d.ts file to not be readable by 5.7?

letprop!: string;exportclassBase1{[prop]!: ()=>void;}

which will produce

declare prop: string;declareexportclassBase1{[prop]: ()=>void;}

except it is readable in 5.7, where I introduced the new computed name index signature behavior for classes (but not earlier), it just has an error in the .d.ts (though will typecheck correctly).

In testing this, I think I found a bug:

A full ID emitter will be forced to retain all possibly-conflicting names, yeah. Which is fine, duplicate declarations basically merge. Where you can, removing dupes from the output is our expected behavior, though.

@dragomirtitian

Copy link
Copy Markdown
Contributor

A full ID emitter will be forced to retain all possibly-conflicting names, yeah. Which is fine, duplicate declarations basically merge. Where you can, removing dupes from the output is our expected behavior, though.

Don't we want to keep declaration emit in sync to what an ID emitter could produce though? Because what I understand form this is that TS will remove the dupes while an ID emitter will not (since it needs type info to do so).

@jakebailey

Copy link
Copy Markdown
Member

Yes, that is why I am concerned; I do not think we should be removing them as we have previously said that we should have one emit that does the same as ID.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamBreaking ChangeWould introduce errors in existing codeFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@weswigham@typescript-bot@MichaelMitchell-at@dragomirtitian@jakebailey@RyanCavanaugh