Skip to content

Resolve apparent mapped types recursively - #57091

Closed
Mateusz Burzyński (Andarist) wants to merge 2 commits into
microsoft:mainfrom
Andarist:resolve-multiple-apparent-mapped-types
Closed

Resolve apparent mapped types recursively#57091
Mateusz Burzyński (Andarist) wants to merge 2 commits into
microsoft:mainfrom
Andarist:resolve-multiple-apparent-mapped-types

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

this expands on #56727
I'm opening this as a draft but I'd love it if somebody could run an extended test suite on this PR in the meantime (cc Gabriela Araujo Britto (@gabritto) )

@typescript-botTypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jan 18, 2024
constraint = getApparentType(modifiersConstraint);
const modifiersType = getModifiersTypeFromMappedType(type);
if (modifiersType) {
constraint = getApparentType(getConstraintOfType(modifiersType) || modifiersType);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'm not particularly fond of this - maybe there is a better way of doing this. This mainly tries to get the apparent type of the modifiers type when the modifiers type is a mapped type itself (like in Mapped<Mapped2<Foo>>). Mapped types don't return anything from getConstraintOfType.

@Andarist

Copy link
Copy Markdown
ContributorAuthor

The test failure doesn't surprise me. It would pass if another problem would get fixed - the one that is being tackled by #50034

The recursive resolution here just uncovers the fact that this other thing doesn't exactly work properly - as far as I was able to investigate so far and I spent 2 nights on this.

@gabritto

Copy link
Copy Markdown
Member

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the parallelized Definitely Typed test suite on this PR at 342f700. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the regular perf test suite on this PR at 342f700. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based top-repos suite on this PR at 342f700. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based user code test suite on this PR at 342f700. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Gabriela Araujo Britto (@gabritto) Here are the results of running the user test suite comparing main and refs/pull/57091/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

puppeteer

packages/browsers/test/src/tsconfig.json

@typescript-bot

Copy link
Copy Markdown
Contributor

Gabriela Araujo Britto (@gabritto)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Angular - node (v18.15.0, x64)
Memory used295,619k (± 0.00%)295,612k (± 0.01%)~295,579k295,630kp=0.574 n=6
Parse Time2.65s (± 0.19%)2.65s (± 0.28%)~2.64s2.66sp=0.784 n=6
Bind Time0.83s (± 0.49%)0.83s (± 1.52%)~0.82s0.85sp=0.930 n=6
Check Time8.17s (± 0.38%)8.15s (± 0.53%)~8.08s8.19sp=0.747 n=6
Emit Time7.08s (± 0.35%)7.08s (± 0.33%)~7.05s7.11sp=1.000 n=6
Total Time18.73s (± 0.18%)18.72s (± 0.24%)~18.66s18.78sp=0.686 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used193,342k (± 1.20%)194,462k (± 1.66%)~191,501k197,498kp=0.378 n=6
Parse Time1.36s (± 0.93%)1.37s (± 1.26%)~1.35s1.39sp=0.402 n=6
Bind Time0.72s (± 0.00%)0.72s (± 0.00%)~0.72s0.72sp=1.000 n=6
Check Time9.36s (± 0.21%)9.38s (± 0.30%)~9.33s9.41sp=0.332 n=6
Emit Time2.62s (± 0.75%)2.61s (± 0.40%)~2.60s2.63sp=0.289 n=6
Total Time14.07s (± 0.17%)14.08s (± 0.26%)~14.01s14.10sp=0.212 n=6
Monaco - node (v18.15.0, x64)
Memory used347,395k (± 0.00%)347,387k (± 0.01%)~347,365k347,409kp=0.575 n=6
Parse Time2.47s (± 0.42%)2.47s (± 0.60%)~2.45s2.48sp=0.676 n=6
Bind Time0.93s (± 0.56%)0.93s (± 0.56%)~0.92s0.93sp=1.000 n=6
Check Time6.89s (± 0.48%)6.88s (± 0.37%)~6.86s6.92sp=0.683 n=6
Emit Time4.05s (± 0.19%)4.05s (± 0.16%)~4.04s4.06sp=0.718 n=6
Total Time14.33s (± 0.19%)14.33s (± 0.22%)~14.30s14.37sp=0.934 n=6
TFS - node (v18.15.0, x64)
Memory used302,803k (± 0.01%)302,779k (± 0.00%)~302,762k302,794kp=0.092 n=6
Parse Time2.01s (± 0.68%)2.01s (± 1.16%)~1.98s2.04sp=0.935 n=6
Bind Time1.00s (± 0.41%)1.00s (± 1.09%)~0.99s1.02sp=0.445 n=6
Check Time6.30s (± 0.35%)6.30s (± 0.34%)~6.27s6.33sp=0.871 n=6
Emit Time3.58s (± 0.25%)3.59s (± 0.33%)~3.58s3.61sp=0.114 n=6
Total Time12.90s (± 0.16%)12.91s (± 0.32%)~12.86s12.96sp=0.569 n=6
material-ui - node (v18.15.0, x64)
Memory used511,156k (± 0.00%)511,167k (± 0.00%)~511,129k511,187kp=0.298 n=6
Parse Time2.64s (± 0.28%)2.64s (± 0.56%)~2.61s2.65sp=1.000 n=6
Bind Time1.00s (± 0.98%)0.99s (± 0.82%)~0.99s1.01sp=0.235 n=6
Check Time17.15s (± 0.43%)17.14s (± 0.52%)~17.02s17.26sp=0.936 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time20.79s (± 0.39%)20.78s (± 0.45%)~20.64s20.89sp=0.809 n=6
xstate - node (v18.15.0, x64)
Memory used513,382k (± 0.01%)513,420k (± 0.01%)~513,313k513,486kp=0.378 n=6
Parse Time3.29s (± 0.25%)3.29s (± 0.19%)~3.28s3.30sp=0.599 n=6
Bind Time1.54s (± 0.33%)1.54s (± 0.26%)~1.54s1.55sp=0.595 n=6
Check Time2.84s (± 0.61%)2.84s (± 0.66%)~2.82s2.87sp=0.746 n=6
Emit Time0.08s (± 0.00%)0.08s (± 0.00%)~0.08s0.08sp=1.000 n=6
Total Time7.75s (± 0.21%)7.75s (± 0.22%)~7.72s7.77sp=0.453 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • xstate - 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,348ms (± 0.69%)2,352ms (± 0.55%)~2,337ms2,369msp=0.810 n=6
Req 2 - geterr5,505ms (± 1.19%)5,541ms (± 1.72%)~5,433ms5,646msp=0.630 n=6
Req 3 - references325ms (± 1.11%)326ms (± 1.84%)~320ms336msp=0.808 n=6
Req 4 - navto276ms (± 0.90%)276ms (± 0.48%)~274ms278msp=0.867 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo85ms (± 8.11%)91ms (± 6.01%)~84ms95msp=0.058 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,473ms (± 1.06%)2,470ms (± 1.16%)~2,435ms2,522msp=0.689 n=6
Req 2 - geterr4,142ms (± 1.47%)4,183ms (± 1.85%)~4,106ms4,262msp=0.689 n=6
Req 3 - references334ms (± 1.72%)334ms (± 1.12%)~331ms341msp=0.934 n=6
Req 4 - navto285ms (± 0.42%)285ms (± 1.01%)~283ms291msp=1.000 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo80ms (±10.60%)79ms (± 7.58%)~74ms90msp=0.744 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,608ms (± 0.42%)2,606ms (± 0.69%)~2,579ms2,627msp=0.747 n=6
Req 2 - geterr1,720ms (± 2.26%)1,692ms (± 2.43%)~1,651ms1,767msp=0.378 n=6
Req 3 - references113ms (± 9.53%)123ms (± 6.60%)~106ms126msp=0.317 n=6
Req 4 - navto364ms (± 0.70%)365ms (± 0.38%)~363ms367msp=1.000 n=6
Req 5 - completionInfo count2,078 (± 0.00%)2,078 (± 0.00%)~2,0782,078p=1.000 n=6
Req 5 - completionInfo310ms (± 0.78%)307ms (± 0.95%)~304ms312msp=0.062 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)
  • xstateTSServer - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

startup

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
tsc-startup - node (v18.15.0, x64)
Execution time153.95ms (± 0.20%)153.83ms (± 0.20%)-0.12ms (- 0.08%)152.65ms157.49msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time230.47ms (± 0.18%)230.32ms (± 0.16%)-0.15ms (- 0.06%)228.94ms233.20msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time231.26ms (± 0.18%)231.16ms (± 0.22%)-0.10ms (- 0.04%)229.60ms243.34msp=0.003 n=600
typescript-startup - node (v18.15.0, x64)
Execution time230.97ms (± 0.19%)230.90ms (± 0.20%)-0.08ms (- 0.03%)229.40ms236.22msp=0.039 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

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Gabriela Araujo Britto (@gabritto), 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

Gabriela Araujo Britto (@gabritto) Here are the results of running the top-repos suite comparing main and refs/pull/57091/merge:

Something interesting changed - please have a look.

Details

chakra-ui/chakra-ui

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

packages/components/tsconfig.build.json

  • error TS5056: Cannot write file '/mnt/ts_downloads/chakra-ui/packages/components/dist/types/menu/menu.stories.d.ts' because it would be overwritten by multiple input files.
    • Project Scope

@Andarist
Mateusz Burzyński (Andarist) marked this pull request as ready for review January 18, 2024 23:11
@typescript-bot

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@Andarist

Copy link
Copy Markdown
ContributorAuthor

I pushed out a test case that shows how this is an improvement. It fixes the VS Code's build failure that Jake Bailey (@jakebailey) reported post-merge here.

It's obviously not perfect right now because ramdaToolsNoInfinite test case fails. As mentioned above, that would get fixed with #50034 (or an alternative fix to the underlying issue).

@Andarist
Mateusz Burzyński (Andarist) marked this pull request as draft January 20, 2024 08:01
@Andarist

Copy link
Copy Markdown
ContributorAuthor

superseded by #57122

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Andarist@gabritto@typescript-bot