Skip to content

Conversation

@iisaduan
Copy link
Member

@iisaduaniisaduan commented Jul 19, 2024

fixes#50603, which bisected to #49119

Previously: unconstrained type parameters were inconsistently checked in comparisons, as shown below (5.5.3 playground):

functionf<T>(a: T,b: T){returna>b; \\ okay}functiong<Textends{}|undefined|null>(a: T,b: T){returna>b; \\ error!! \\ 'a'ispossibly'null'or'undefined'.ts(18049) \\ 'b'ispossibly'null'or'undefined'.ts(18049)}

Now with this PR:

functionf1<T>(a: T,b: T): boolean{returna>b;~!!!errorTS18046: 'a'isoftype'unknown'.~!!!errorTS18046: 'b'isoftype'unknown'.}functionf2<Textends{}|undefined|null>(a: T,b: T): boolean{returna>b;~!!!errorTS18049: 'a'ispossibly'null'or'undefined'.~!!!errorTS18049: 'b'ispossibly'null'or'undefined'.}

This PR does not affect the checking of unconstrained types in other locations.

@iisaduaniisaduan marked this pull request as ready for review July 19, 2024 03:34
@iisaduan
Copy link
MemberAuthor

@typescript-bot test it
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 19, 2024

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

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 19, 2024

Hey @iisaduan, 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/162857/artifacts?artifactName=tgz&fileId=44CAF8D1A815E861B024867349A1BA4D64F7A3FF9ADC7FD310912E8F233464F902&fileName=/typescript-5.6.0-insiders.20240719.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/[email protected]".;

@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests with tsc comparing main and refs/pull/59352/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@iisaduan
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,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used192,883k (± 0.75%)192,382k (± 0.10%)~192,239k192,624kp=0.689 n=6
Parse Time1.29s (± 0.90%)1.30s (± 0.80%)~1.29s1.32sp=0.085 n=6
Bind Time0.71s0.71s~~~p=1.000 n=6
Check Time9.54s (± 0.45%)9.50s (± 0.48%)~9.43s9.55sp=0.170 n=6
Emit Time2.76s (± 0.55%)2.75s (± 0.68%)~2.73s2.77sp=0.933 n=6
Total Time14.30s (± 0.35%)14.27s (± 0.35%)~14.21s14.35sp=0.336 n=6
angular-1 - node (v18.15.0, x64)
Errors515🔻+10 (+200.00%)~~p=0.001 n=6
Symbols944,250944,250~~~p=1.000 n=6
Types407,076407,076~~~p=1.000 n=6
Memory used1,218,709k (± 0.00%)1,218,714k (± 0.00%)~1,218,661k1,218,766kp=0.810 n=6
Parse Time6.72s (± 0.64%)6.69s (± 0.55%)~6.63s6.73sp=0.227 n=6
Bind Time1.87s (± 0.83%)1.87s (± 0.79%)~1.85s1.88sp=0.784 n=6
Check Time31.01s (± 0.17%)31.01s (± 0.38%)~30.91s31.23sp=0.574 n=6
Emit Time15.02s (± 0.71%)14.96s (± 0.17%)~14.93s15.01sp=0.288 n=6
Total Time54.61s (± 0.17%)54.53s (± 0.21%)~54.40s54.71sp=0.230 n=6
mui-docs - node (v18.15.0, x64)
Errors016🔻+16 (+ ∞%)~~p=0.001 n=6
Symbols2,276,1562,276,156~~~p=1.000 n=6
Types948,845948,825-20 (- 0.00%)~~p=0.001 n=6
Memory used2,207,610k (± 0.00%)2,207,609k (± 0.00%)~2,207,577k2,207,642kp=1.000 n=6
Parse Time6.61s (± 0.18%)6.60s (± 0.25%)~6.58s6.62sp=0.103 n=6
Bind Time2.33s (± 0.22%)2.33s (± 0.35%)~2.32s2.34sp=0.929 n=6
Check Time73.08s (± 0.37%)73.12s (± 0.29%)~72.75s73.32sp=0.872 n=6
Emit Time0.14s0.14s (± 6.38%)~0.13s0.15sp=1.000 n=6
Total Time82.17s (± 0.33%)82.19s (± 0.26%)~81.82s82.37sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,227,3321,227,334+2 (+ 0.00%)~~p=0.001 n=6
Types261,851261,852+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,341,654k (± 0.02%)2,341,474k (± 0.02%)~2,340,763k2,342,012kp=0.471 n=6
Parse Time5.10s (± 0.55%)5.12s (± 0.85%)~5.06s5.17sp=0.471 n=6
Bind Time1.90s (± 0.43%)1.91s (± 1.03%)~1.88s1.93sp=0.744 n=6
Check Time34.39s (± 0.38%)34.57s (± 0.11%)+0.18s (+ 0.51%)34.53s34.62sp=0.013 n=6
Emit Time3.29s (± 2.35%)3.32s (± 2.44%)~3.22s3.40sp=0.470 n=6
Total Time44.69s (± 0.15%)44.91s (± 0.11%)+0.23s (+ 0.51%)44.85s44.98sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,227,3321,227,334+2 (+ 0.00%)~~p=0.001 n=6
Types261,851261,852+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,475,459k (± 5.82%)2,534,670k (±11.36%)~2,416,382k3,123,003kp=0.378 n=6
Parse Time7.85s (± 0.77%)7.88s (± 0.74%)~7.82s7.98sp=0.688 n=6
Bind Time2.50s (± 0.73%)2.50s (± 1.29%)~2.46s2.54sp=1.000 n=6
Check Time50.57s (± 0.65%)50.75s (± 0.67%)~50.50s51.42sp=0.936 n=6
Emit Time4.87s (± 2.12%)4.87s (± 1.08%)~4.80s4.93sp=0.936 n=6
Total Time65.81s (± 0.58%)66.01s (± 0.63%)~65.69s66.83sp=1.000 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,516258,518+2 (+ 0.00%)~~p=0.001 n=6
Types104,901104,902+1 (+ 0.00%)~~p=0.001 n=6
Memory used427,933k (± 0.02%)427,880k (± 0.03%)~427,778k428,078kp=0.298 n=6
Parse Time4.15s (± 0.30%)4.15s (± 0.33%)~4.13s4.17sp=0.547 n=6
Bind Time1.63s (± 1.44%)1.62s (± 1.20%)~1.60s1.65sp=0.405 n=6
Check Time22.15s (± 0.44%)22.23s (± 0.40%)~22.10s22.38sp=0.170 n=6
Emit Time2.01s (± 1.03%)2.01s (± 0.83%)~1.99s2.03sp=1.000 n=6
Total Time29.94s (± 0.23%)30.01s (± 0.28%)~29.88s30.14sp=0.149 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,565224,565~~~p=1.000 n=6
Types93,73493,734~~~p=1.000 n=6
Memory used369,623k (± 0.02%)369,740k (± 0.03%)~369,571k369,882kp=0.128 n=6
Parse Time3.45s (± 0.59%)3.45s (± 0.90%)~3.42s3.50sp=0.808 n=6
Bind Time1.93s (± 0.78%)1.94s (± 0.65%)~1.92s1.95sp=0.134 n=6
Check Time19.33s (± 0.38%)19.36s (± 0.23%)~19.30s19.41sp=0.336 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time24.71s (± 0.25%)24.75s (± 0.31%)~24.64s24.84sp=0.298 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,973,1262,973,126~~~p=1.000 n=6
Types1,021,0751,021,075~~~p=1.000 n=6
Memory used3,097,512k (± 0.00%)3,097,551k (± 0.00%)~3,097,468k3,097,652kp=0.575 n=6
Parse Time13.93s (± 0.27%)13.89s (± 0.33%)~13.83s13.95sp=0.127 n=6
Bind Time4.44s (± 2.10%)4.39s (± 2.95%)~4.27s4.53sp=1.000 n=6
Check Time79.00s (± 0.23%)79.20s (± 0.30%)~78.92s79.49sp=0.261 n=6
Emit Time20.31s (± 0.42%)20.35s (± 0.85%)~20.15s20.65sp=0.630 n=6
Total Time117.68s (± 0.21%)117.83s (± 0.29%)~117.25s118.28sp=0.378 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,370267,370~~~p=1.000 n=6
Types108,862108,862~~~p=1.000 n=6
Memory used411,941k (± 0.02%)411,946k (± 0.02%)~411,871k412,054kp=0.936 n=6
Parse Time4.74s (± 0.68%)4.76s (± 0.39%)~4.72s4.77sp=0.357 n=6
Bind Time2.09s (± 0.78%)2.08s (± 0.39%)~2.08s2.10sp=0.227 n=6
Check Time20.82s (± 0.24%)20.89s (± 0.40%)~20.79s21.00sp=0.199 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.65s (± 0.24%)27.73s (± 0.36%)~27.63s27.87sp=0.173 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols510,573510,573~~~p=1.000 n=6
Types161,621161,621~~~p=1.000 n=6
Memory used448,203k (± 0.09%)448,328k (± 0.08%)~447,792k448,626kp=0.748 n=6
Parse Time3.16s (± 0.74%)3.17s (± 0.94%)~3.13s3.20sp=0.514 n=6
Bind Time1.18s (± 1.25%)1.17s (± 0.44%)~1.16s1.17sp=0.210 n=6
Check Time17.16s (± 0.45%)17.18s (± 0.45%)~17.05s17.29sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time21.49s (± 0.38%)21.52s (± 0.50%)~21.35s21.66sp=0.872 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
Collaborator

@iisaduan Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59352/merge:

Something interesting changed - please have a look.

Details

ag-grid/ag-grid

31 of 110 projects failed to build with the old tsc and were ignored

enterprise-modules/viewport-row-model/tsconfig.watch.json

enterprise-modules/viewport-row-model/tsconfig.types.watch.json

enterprise-modules/status-bar/tsconfig.watch.json

enterprise-modules/status-bar/tsconfig.types.watch.json

enterprise-modules/sparklines/tsconfig.watch.json

enterprise-modules/sparklines/tsconfig.types.watch.json

enterprise-modules/side-bar/tsconfig.watch.json

enterprise-modules/side-bar/tsconfig.types.watch.json

enterprise-modules/set-filter/tsconfig.watch.json

enterprise-modules/set-filter/tsconfig.types.watch.json

enterprise-modules/server-side-row-model/tsconfig.watch.json

enterprise-modules/server-side-row-model/tsconfig.types.watch.json

enterprise-modules/row-grouping/tsconfig.watch.json

enterprise-modules/row-grouping/tsconfig.types.watch.json

enterprise-modules/rich-select/tsconfig.watch.json

enterprise-modules/rich-select/tsconfig.types.watch.json

enterprise-modules/range-selection/tsconfig.watch.json

enterprise-modules/range-selection/tsconfig.types.watch.json

enterprise-modules/multi-filter/tsconfig.watch.json

enterprise-modules/multi-filter/tsconfig.types.watch.json

enterprise-modules/master-detail/tsconfig.watch.json

enterprise-modules/master-detail/tsconfig.types.watch.json

enterprise-modules/filter-tool-panel/tsconfig.watch.json

enterprise-modules/filter-tool-panel/tsconfig.types.watch.json

enterprise-modules/core/tsconfig.watch.json

enterprise-modules/core/tsconfig.types.watch.json

enterprise-modules/advanced-filter/tsconfig.watch.json

enterprise-modules/advanced-filter/tsconfig.types.watch.json

community-modules/vue3/tsconfig.watch.json

community-modules/vue3/tsconfig.types.watch.json

community-modules/infinite-row-model/tsconfig.watch.json

community-modules/infinite-row-model/tsconfig.types.watch.json

community-modules/csv-export/tsconfig.watch.json

community-modules/csv-export/tsconfig.types.watch.json

community-modules/core/tsconfig.watch.json

community-modules/core/tsconfig.types.watch.json

community-modules/client-side-row-model/tsconfig.watch.json

community-modules/client-side-row-model/tsconfig.types.watch.json

compiler-explorer/compiler-explorer

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

tsconfig.tests.json

tsconfig.json

static/tsconfig.json

desktop/desktop

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

tsconfig.json

discordjs/discord.js

39 of 62 projects failed to build with the old tsc and were ignored

packages/collection/tsconfig.json

packages/collection/tsconfig.eslint.json

packages/collection/tsconfig.docs.json

mui/material-ui

29 of 81 projects failed to build with the old tsc and were ignored

docs/tsconfig.json

sequelize/sequelize

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

packages/utils/tsconfig.json

@iisaduaniisaduan changed the title consistently check for >, >=, <, <= for unconstrained types with strictNullChecksconsistently check expressions with >, >=, <, <= for unconstrained types with strictNullChecksJul 19, 2024
@iisaduaniisaduan changed the title consistently check expressions with >, >=, <, <= for unconstrained types with strictNullChecksconsistently check expressions with >, >=, <, <= for unconstrained types in strictNullChecksJul 19, 2024

// use to determine if a parameter may be undefined or null (or is unknown/unconstrained)
function getUnknownIfMaybeUnknown(type: Type){
return (strictNullChecks && type.flags & TypeFlags.Instantiable) ? getBaseConstraintOfType(type) || unknownType : type;
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming from #59059 that making this change to getTypeFacts breaks a lot of existing code, is that right?

Also, does making this change to checkNonNullType instead also break a lot of code?

Copy link
MemberAuthor

@iisaduaniisaduanJul 19, 2024

Choose a reason for hiding this comment

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

Yes, I tried that and putting this change directly into checkNonNullType gets a very similar result to #59059 in terms of breaking object index checking

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

A lot of the cases that break relate to this type of index access #59059 (comment)

Choose a reason for hiding this comment

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

I don't know if this it's noticeably different in semantics, but istead of doing this, you might want to try to modify getBaseTypeOfLiteralTypeForComparison and rename it getBaseTypeForComparison. Then pass the result of that into checkNonNullType.

Choose a reason for hiding this comment

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

I would also consider renaming this to getBaseConstraintOrUnknown, use ?? instead of ||, and just get rid of the strictNullChecks check.

Choose a reason for hiding this comment

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

Also - any clue if this works on unions of unconstrained type parameters? Can you add a test?

functionf<T,U>(x: T|U,y: T|U){returnx<y;}

gabritto
gabritto previously approved these changes Jul 19, 2024
@DanielRosenwasser
Copy link
Member

Checking this

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 20, 2024

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

CommandStatusResults
perf test this✅ Started👀 Results


// use to determine if a parameter may be undefined or null (or is unknown/unconstrained)
function getUnknownIfMaybeUnknown(type: Type){
return (strictNullChecks && type.flags & TypeFlags.Instantiable) ? getBaseConstraintOfType(type) || unknownType : type;

Choose a reason for hiding this comment

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

I don't know if this it's noticeably different in semantics, but istead of doing this, you might want to try to modify getBaseTypeOfLiteralTypeForComparison and rename it getBaseTypeForComparison. Then pass the result of that into checkNonNullType.


// use to determine if a parameter may be undefined or null (or is unknown/unconstrained)
function getUnknownIfMaybeUnknown(type: Type){
return (strictNullChecks && type.flags & TypeFlags.Instantiable) ? getBaseConstraintOfType(type) || unknownType : type;

Choose a reason for hiding this comment

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

I would also consider renaming this to getBaseConstraintOrUnknown, use ?? instead of ||, and just get rid of the strictNullChecks check.


// use to determine if a parameter may be undefined or null (or is unknown/unconstrained)
function getUnknownIfMaybeUnknown(type: Type){
return (strictNullChecks && type.flags & TypeFlags.Instantiable) ? getBaseConstraintOfType(type) || unknownType : type;

Choose a reason for hiding this comment

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

Also - any clue if this works on unions of unconstrained type parameters? Can you add a test?

functionf<T,U>(x: T|U,y: T|U){returnx<y;}

@typescript-bot
Copy link
Collaborator

@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)
Errors3030~~~p=1.000 n=6
Symbols62,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used193,514k (± 0.93%)194,037k (± 1.04%)~191,979k195,930kp=0.575 n=6
Parse Time1.95s (± 0.50%)1.96s (± 1.05%)~1.93s1.99sp=0.869 n=6
Bind Time1.06s (± 1.73%)1.05s (± 0.72%)~1.04s1.06sp=0.367 n=6
Check Time13.96s (± 0.60%)13.98s (± 0.58%)~13.86s14.09sp=0.747 n=6
Emit Time3.99s (± 1.06%)4.08s (± 4.18%)~3.92s4.41sp=0.296 n=6
Total Time20.97s (± 0.46%)21.06s (± 0.68%)~20.92s21.32sp=0.468 n=6
angular-1 - node (v18.15.0, x64)
Errors717🔻+10 (+142.86%)~~p=0.001 n=6
Symbols945,532945,532~~~p=1.000 n=6
Types409,507409,507~~~p=1.000 n=6
Memory used1,221,076k (± 0.00%)1,221,066k (± 0.00%)~1,220,987k1,221,112kp=1.000 n=6
Parse Time7.84s (± 0.44%)7.88s (± 0.54%)~7.82s7.93sp=0.173 n=6
Bind Time2.22s (± 1.54%)2.21s (± 0.62%)~2.19s2.23sp=0.455 n=6
Check Time36.36s (± 0.41%)36.36s (± 0.34%)~36.20s36.56sp=0.688 n=6
Emit Time17.83s (± 0.57%)17.90s (± 0.97%)~17.72s18.14sp=0.575 n=6
Total Time64.26s (± 0.38%)64.34s (± 0.29%)~64.08s64.57sp=0.689 n=6
mui-docs - node (v18.15.0, x64)
Errors016🔻+16 (+ ∞%)~~p=0.001 n=6
Symbols2,276,2932,276,293~~~p=1.000 n=6
Types949,028949,008-20 (- 0.00%)~~p=0.001 n=6
Memory used2,208,070k (± 0.00%)2,208,060k (± 0.00%)~2,207,931k2,208,140kp=0.689 n=6
Parse Time9.64s (± 0.36%)9.67s (± 0.42%)~9.62s9.73sp=0.295 n=6
Bind Time3.36s (± 0.69%)3.37s (± 1.46%)~3.30s3.45sp=0.686 n=6
Check Time105.65s (± 0.50%)105.04s (± 1.44%)~101.99s106.12sp=0.471 n=6
Emit Time0.21s (± 4.71%)0.21s (± 3.95%)~0.20s0.22sp=0.862 n=6
Total Time118.86s (± 0.47%)118.27s (± 1.26%)~115.27s119.32sp=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,4001,230,402+2 (+ 0.00%)~~p=0.001 n=6
Types265,743265,744+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,348,382k (± 0.03%)2,347,304k (± 0.03%)-1,079k (- 0.05%)2,346,190k2,348,045kp=0.020 n=6
Parse Time7.57s (± 0.92%)7.54s (± 0.73%)~7.47s7.63sp=0.575 n=6
Bind Time2.80s (± 0.54%)2.79s (± 0.53%)~2.77s2.80sp=0.296 n=6
Check Time50.24s (± 0.30%)50.37s (± 0.75%)~49.98s51.02sp=0.689 n=6
Emit Time4.86s (± 3.31%)4.93s (± 2.34%)~4.80s5.11sp=0.378 n=6
Total Time65.48s (± 0.28%)65.63s (± 0.67%)~65.13s66.43sp=0.470 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,4001,230,402+2 (+ 0.00%)~~p=0.001 n=6
Types265,743265,744+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,420,996k (± 0.02%)2,420,837k (± 0.01%)~2,420,310k2,421,277kp=0.471 n=6
Parse Time5.28s (± 0.82%)5.31s (± 0.30%)~5.30s5.34sp=0.261 n=6
Bind Time1.70s (± 0.32%)1.69s (± 0.61%)~1.68s1.70sp=0.147 n=6
Check Time35.09s (± 0.37%)35.09s (± 0.17%)~35.03s35.20sp=0.936 n=6
Emit Time3.38s (± 1.88%)3.39s (± 1.09%)~3.36s3.45sp=1.000 n=6
Total Time45.43s (± 0.25%)45.47s (± 0.09%)~45.41s45.54sp=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,792258,794+2 (+ 0.00%)~~p=0.001 n=6
Types105,554105,555+1 (+ 0.00%)~~p=0.001 n=6
Memory used428,546k (± 0.03%)428,566k (± 0.02%)~428,464k428,718kp=0.689 n=6
Parse Time3.35s (± 0.76%)3.36s (± 0.77%)~3.32s3.39sp=0.627 n=6
Bind Time1.32s (± 0.57%)1.32s (± 1.33%)~1.29s1.34sp=0.196 n=6
Check Time18.03s (± 0.55%)18.05s (± 0.43%)~17.93s18.17sp=0.936 n=6
Emit Time1.65s (± 1.07%)1.64s (± 0.86%)~1.62s1.66sp=0.677 n=6
Total Time24.35s (± 0.40%)24.37s (± 0.38%)~24.27s24.52sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,931224,931~~~p=1.000 n=6
Types94,14694,146~~~p=1.000 n=6
Memory used370,029k (± 0.04%)370,082k (± 0.05%)~369,841k370,313kp=0.575 n=6
Parse Time3.45s (± 1.24%)3.43s (± 0.40%)~3.42s3.45sp=0.568 n=6
Bind Time1.91s (± 1.07%)1.91s (± 0.61%)~1.90s1.93sp=1.000 n=6
Check Time19.24s (± 0.53%)19.29s (± 0.19%)~19.24s19.34sp=0.126 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time24.61s (± 0.58%)24.64s (± 0.16%)~24.60s24.71sp=0.334 n=6
vscode - node (v18.15.0, x64)
Errors44~~~p=1.000 n=6
Symbols2,978,9232,978,923~~~p=1.000 n=6
Types1,024,9321,024,932~~~p=1.000 n=6
Memory used3,104,101k (± 0.00%)3,104,077k (± 0.00%)~3,104,022k3,104,106kp=0.630 n=6
Parse Time13.92s (± 0.31%)13.89s (± 0.34%)~13.82s13.95sp=0.332 n=6
Bind Time4.29s (± 0.28%)4.30s (± 0.35%)~4.27s4.31sp=0.218 n=6
Check Time79.32s (± 0.33%)79.13s (± 0.30%)~78.71s79.36sp=0.810 n=6
Emit Time20.54s (± 0.57%)20.49s (± 0.29%)~20.44s20.60sp=0.376 n=6
Total Time118.07s (± 0.19%)117.80s (± 0.15%)-0.27s (- 0.23%)117.54s118.01sp=0.045 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,602267,602~~~p=1.000 n=6
Types109,105109,105~~~p=1.000 n=6
Memory used412,322k (± 0.01%)412,295k (± 0.02%)~412,176k412,391kp=0.689 n=6
Parse Time3.83s (± 0.54%)3.83s (± 0.39%)~3.82s3.86sp=1.000 n=6
Bind Time1.71s (± 0.48%)1.71s (± 1.02%)~1.68s1.73sp=0.605 n=6
Check Time16.80s (± 0.30%)16.77s (± 0.44%)~16.68s16.86sp=0.421 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.34s (± 0.28%)22.32s (± 0.34%)~22.22s22.41sp=0.470 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols511,803511,803~~~p=1.000 n=6
Types162,088162,088~~~p=1.000 n=6
Memory used449,026k (± 0.07%)449,068k (± 0.08%)~448,602k449,376kp=0.810 n=6
Parse Time3.89s (± 0.32%)3.91s (± 0.86%)~3.88s3.97sp=0.250 n=6
Bind Time1.44s (± 1.04%)1.44s (± 0.81%)~1.42s1.45sp=0.616 n=6
Check Time21.23s (± 0.16%)21.27s (± 0.44%)~21.14s21.36sp=0.810 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time26.56s (± 0.15%)26.61s (± 0.38%)~26.46s26.72sp=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

tsserver

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,758ms (± 1.21%)2,878ms (± 9.31%)~2,757ms3,425msp=0.470 n=6
Req 2 - geterr6,822ms (±10.70%)7,056ms (± 9.52%)~6,172ms7,602msp=0.575 n=6
Req 3 - references368ms (±10.59%)392ms (± 0.25%)~391ms393msp=1.000 n=6
Req 4 - navto339ms (± 0.12%)339ms (± 0.69%)~334ms340msp=0.546 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo128ms (± 7.04%)127ms (± 5.80%)~121ms136msp=0.570 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen3,573ms (± 0.97%)3,577ms (± 0.88%)~3,515ms3,602msp=1.000 n=6
Req 2 - geterr5,687ms (± 0.52%)5,677ms (± 0.45%)~5,645ms5,718msp=0.575 n=6
Req 3 - references413ms (± 1.13%)409ms (± 1.51%)~400ms419msp=0.328 n=6
Req 4 - navto341ms (± 1.59%)342ms (± 2.76%)~336ms361msp=1.000 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo124ms (± 0.66%)117ms (± 8.98%)~100ms125msp=0.402 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen6,352ms (± 4.95%)6,474ms (± 6.06%)~6,201ms7,006msp=0.689 n=6
Req 2 - geterr1,664ms (± 0.98%)1,493ms (±12.49%)~1,307ms1,691msp=0.149 n=6
Req 3 - references127ms (± 5.01%)126ms (± 9.18%)~103ms134msp=0.560 n=6
Req 4 - navto597ms (± 1.59%)605ms (± 0.93%)~600ms616msp=0.077 n=6
Req 5 - completionInfo count3,4173,417~~~p=1.000 n=6
Req 5 - completionInfo1,243ms (± 1.30%)1,240ms (± 1.71%)~1,198ms1,255msp=0.748 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstate-main-1-tsserver - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

startup

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
tsc-startup - node (v18.15.0, x64)
Execution time190.28ms (± 0.16%)190.25ms (± 0.18%)~188.48ms195.26msp=0.109 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time346.36ms (± 0.28%)346.16ms (± 0.29%)-0.20ms (- 0.06%)337.79ms353.31msp=0.002 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time277.64ms (± 0.28%)277.76ms (± 0.28%)+0.12ms (+ 0.04%)270.74ms282.26msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time278.33ms (± 0.29%)278.13ms (± 0.28%)-0.20ms (- 0.07%)271.29ms284.76msp=0.000 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@iisaduan
Copy link
MemberAuthor

@DanielRosenwasser Thanks for the suggestions! Good catch--it does work for unions but not intersections, so I added those cases as well.

@gabritto
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 23, 2024

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
Collaborator

@gabritto Here are the results of running the user tests with tsc comparing main and refs/pull/59352/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @gabritto, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@gabritto
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,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used192,300k (± 0.01%)192,912k (± 0.73%)+612k (+ 0.32%)192,286k195,807kp=0.045 n=6
Parse Time1.57s (± 0.96%)1.57s (± 1.04%)~1.55s1.59sp=0.801 n=6
Bind Time0.86s (± 1.04%)0.86s (± 1.40%)~0.85s0.88sp=0.676 n=6
Check Time11.35s (± 0.51%)11.37s (± 0.73%)~11.27s11.47sp=0.467 n=6
Emit Time3.27s (± 0.46%)3.28s (± 0.92%)~3.25s3.33sp=1.000 n=6
Total Time17.05s (± 0.37%)17.09s (± 0.63%)~16.96s17.20sp=0.378 n=6
angular-1 - node (v18.15.0, x64)
Errors717🔻+10 (+142.86%)~~p=0.001 n=6
Symbols945,532945,532~~~p=1.000 n=6
Types409,507409,507~~~p=1.000 n=6
Memory used1,221,136k (± 0.01%)1,221,123k (± 0.00%)~1,221,042k1,221,176kp=0.470 n=6
Parse Time6.59s (± 0.86%)6.62s (± 0.15%)~6.60s6.63sp=0.370 n=6
Bind Time1.85s (± 0.41%)1.85s (± 0.59%)~1.83s1.86sp=1.000 n=6
Check Time31.01s (± 0.15%)31.08s (± 0.24%)~30.99s31.21sp=0.077 n=6
Emit Time15.02s (± 0.53%)15.08s (± 0.44%)~15.01s15.18sp=0.377 n=6
Total Time54.48s (± 0.24%)54.63s (± 0.23%)~54.54s54.87sp=0.128 n=6
mui-docs - node (v18.15.0, x64)
Errors016🔻+16 (+ ∞%)~~p=0.001 n=6
Symbols2,276,4042,276,404~~~p=1.000 n=6
Types949,156949,136-20 (- 0.00%)~~p=0.001 n=6
Memory used2,208,290k (± 0.00%)2,208,352k (± 0.00%)~2,208,292k2,208,411kp=0.054 n=6
Parse Time6.60s (± 0.34%)6.59s (± 0.32%)~6.55s6.61sp=1.000 n=6
Bind Time2.32s (± 0.32%)2.32s (± 0.39%)~2.31s2.33sp=0.798 n=6
Check Time72.84s (± 0.16%)72.84s (± 0.27%)~72.58s73.06sp=0.809 n=6
Emit Time0.14s (± 5.31%)0.14s (± 2.95%)~0.13s0.14sp=0.389 n=6
Total Time81.90s (± 0.15%)81.89s (± 0.27%)~81.58s82.11sp=0.810 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,231,0671,231,070+3 (+ 0.00%)~~p=0.001 n=6
Types266,104266,105+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,349,063k (± 0.02%)2,407,907k (± 6.03%)~2,347,883k2,704,372kp=0.575 n=6
Parse Time5.09s (± 1.07%)5.08s (± 1.40%)~4.99s5.15sp=0.520 n=6
Bind Time1.91s (± 0.54%)1.89s (± 0.65%)-0.02s (- 1.14%)1.86s1.89sp=0.010 n=6
Check Time34.75s (± 0.61%)34.64s (± 0.72%)~34.20s34.88sp=0.630 n=6
Emit Time3.29s (± 1.99%)3.28s (± 1.90%)~3.21s3.38sp=0.936 n=6
Total Time45.04s (± 0.56%)44.90s (± 0.55%)~44.49s45.17sp=0.575 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,231,0671,231,070+3 (+ 0.00%)~~p=0.001 n=6
Types266,104266,105+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,422,907k (± 0.02%)2,423,044k (± 0.02%)~2,422,530k2,423,663kp=0.810 n=6
Parse Time6.34s (± 0.85%)6.30s (± 0.52%)~6.26s6.34sp=0.230 n=6
Bind Time2.04s (± 0.90%)2.04s (± 0.31%)~2.03s2.05sp=0.627 n=6
Check Time41.36s (± 0.30%)41.39s (± 0.24%)~41.24s41.48sp=0.748 n=6
Emit Time4.03s (± 1.22%)3.96s (± 1.01%)-0.07s (- 1.65%)3.89s4.01sp=0.013 n=6
Total Time53.78s (± 0.33%)53.70s (± 0.23%)~53.55s53.82sp=0.128 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols259,215259,218+3 (+ 0.00%)~~p=0.001 n=6
Types105,867105,868+1 (+ 0.00%)~~p=0.001 n=6
Memory used429,634k (± 0.03%)429,611k (± 0.02%)~429,570k429,742kp=0.936 n=6
Parse Time3.35s (± 0.53%)3.36s (± 0.59%)~3.34s3.39sp=0.871 n=6
Bind Time1.32s (± 1.24%)1.33s (± 0.91%)~1.31s1.34sp=0.300 n=6
Check Time18.09s (± 0.30%)18.11s (± 0.17%)~18.07s18.15sp=0.520 n=6
Emit Time1.62s (± 1.89%)1.64s (± 0.51%)~1.62s1.64sp=0.452 n=6
Total Time24.39s (± 0.30%)24.44s (± 0.18%)~24.39s24.50sp=0.296 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,931224,931~~~p=1.000 n=6
Types94,14694,146~~~p=1.000 n=6
Memory used370,151k (± 0.03%)370,137k (± 0.01%)~370,069k370,204kp=0.575 n=6
Parse Time2.75s (± 1.08%)2.76s (± 0.53%)~2.74s2.78sp=0.870 n=6
Bind Time1.58s (± 1.06%)1.58s (± 1.18%)~1.56s1.61sp=0.681 n=6
Check Time15.66s (± 0.19%)15.62s (± 0.16%)-0.04s (- 0.24%)15.58s15.64sp=0.028 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.99s (± 0.16%)19.96s (± 0.07%)~19.94s19.97sp=0.062 n=6
vscode - node (v18.15.0, x64)
Errors1111~~~p=1.000 n=6
Symbols2,986,6432,986,643~~~p=1.000 n=6
Types1,027,5111,027,511~~~p=1.000 n=6
Memory used3,111,141k (± 0.00%)3,111,087k (± 0.00%)~3,111,031k3,111,198kp=0.128 n=6
Parse Time13.80s (± 0.34%)13.83s (± 0.30%)~13.78s13.89sp=0.574 n=6
Bind Time4.29s (± 0.50%)4.33s (± 2.20%)~4.27s4.52sp=1.000 n=6
Check Time79.24s (± 0.17%)79.36s (± 0.49%)~78.86s79.98sp=0.689 n=6
Emit Time20.50s (± 0.73%)20.50s (± 0.52%)~20.31s20.61sp=1.000 n=6
Total Time117.84s (± 0.21%)118.01s (± 0.34%)~117.70s118.74sp=0.630 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,603267,603~~~p=1.000 n=6
Types109,105109,105~~~p=1.000 n=6
Memory used412,306k (± 0.01%)412,379k (± 0.02%)~412,292k412,485kp=0.093 n=6
Parse Time3.18s (± 0.65%)3.18s (± 0.28%)~3.17s3.19sp=0.807 n=6
Bind Time1.43s (± 0.72%)1.43s (± 0.29%)~1.42s1.43sp=0.268 n=6
Check Time14.26s (± 0.28%)14.27s (± 0.57%)~14.15s14.35sp=0.630 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.88s (± 0.17%)18.88s (± 0.42%)~18.76s18.97sp=0.687 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols511,803511,803~~~p=1.000 n=6
Types162,088162,088~~~p=1.000 n=6
Memory used448,938k (± 0.08%)448,974k (± 0.09%)~448,616k449,383kp=0.936 n=6
Parse Time3.91s (± 0.63%)3.91s (± 0.56%)~3.88s3.94sp=1.000 n=6
Bind Time1.45s (± 0.36%)1.44s (± 0.72%)~1.42s1.45sp=0.070 n=6
Check Time21.25s (± 0.21%)21.21s (± 0.39%)~21.09s21.33sp=0.630 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time26.61s (± 0.15%)26.56s (± 0.40%)~26.40s26.71sp=0.336 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
Collaborator

@gabritto Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59352/merge:

Something interesting changed - please have a look.

Details

ag-grid/ag-grid

31 of 110 projects failed to build with the old tsc and were ignored

enterprise-modules/viewport-row-model/tsconfig.watch.json

enterprise-modules/viewport-row-model/tsconfig.types.watch.json

enterprise-modules/status-bar/tsconfig.watch.json

enterprise-modules/status-bar/tsconfig.types.watch.json

enterprise-modules/sparklines/tsconfig.watch.json

enterprise-modules/sparklines/tsconfig.types.watch.json

enterprise-modules/side-bar/tsconfig.watch.json

enterprise-modules/side-bar/tsconfig.types.watch.json

enterprise-modules/set-filter/tsconfig.watch.json

enterprise-modules/set-filter/tsconfig.types.watch.json

enterprise-modules/server-side-row-model/tsconfig.watch.json

enterprise-modules/server-side-row-model/tsconfig.types.watch.json

enterprise-modules/row-grouping/tsconfig.watch.json

enterprise-modules/row-grouping/tsconfig.types.watch.json

enterprise-modules/rich-select/tsconfig.watch.json

enterprise-modules/rich-select/tsconfig.types.watch.json

enterprise-modules/range-selection/tsconfig.watch.json

enterprise-modules/range-selection/tsconfig.types.watch.json

enterprise-modules/multi-filter/tsconfig.watch.json

enterprise-modules/multi-filter/tsconfig.types.watch.json

enterprise-modules/master-detail/tsconfig.watch.json

enterprise-modules/master-detail/tsconfig.types.watch.json

enterprise-modules/filter-tool-panel/tsconfig.watch.json

enterprise-modules/filter-tool-panel/tsconfig.types.watch.json

enterprise-modules/core/tsconfig.watch.json

enterprise-modules/core/tsconfig.types.watch.json

enterprise-modules/advanced-filter/tsconfig.watch.json

enterprise-modules/advanced-filter/tsconfig.types.watch.json

community-modules/vue3/tsconfig.watch.json

community-modules/vue3/tsconfig.types.watch.json

community-modules/infinite-row-model/tsconfig.watch.json

community-modules/infinite-row-model/tsconfig.types.watch.json

community-modules/csv-export/tsconfig.watch.json

community-modules/csv-export/tsconfig.types.watch.json

community-modules/core/tsconfig.watch.json

community-modules/core/tsconfig.types.watch.json

community-modules/client-side-row-model/tsconfig.watch.json

community-modules/client-side-row-model/tsconfig.types.watch.json

compiler-explorer/compiler-explorer

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

static/tsconfig.json

desktop/desktop

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

tsconfig.json

sequelize/sequelize

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

packages/utils/tsconfig.json

ahejlsberg added a commit that referenced this pull request Jul 26, 2024
@ahejlsberg
Copy link
Member

I have just put up #59437 which I believe is the right fix for #50603 plus the inconsistencies related to unconstrained type parameters vs. type parameters constrained to {} | null | undefined. There are an awful lot of interacting parts here. In particular, it only becomes feasible to check that unconstrained generic types are possibly nullable in --strictNullChecks mode by first fixing the fact that obj shouldn't be null-checked in obj[key] when obj and key both have generic types.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No error on unconstrained type parameter in > comparison

7 participants

@iisaduan@typescript-bot@DanielRosenwasser@gabritto@ahejlsberg@weswigham@andrewbranch