Skip to content

isolatedModules error on alias merging with local value - #56354

Merged
Andrew Branch (andrewbranch) merged 2 commits into
microsoft:mainfrom
andrewbranch:bug/55584
Nov 15, 2023
Merged

isolatedModules error on alias merging with local value#56354
Andrew Branch (andrewbranch) merged 2 commits into
microsoft:mainfrom
andrewbranch:bug/55584

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Fixes#55584

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@andrewbranch), I've started to run the regular perf test suite on this PR at 5546b58. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@andrewbranch), I've started to run the diff-based top-repos suite on this PR at 5546b58. You can monitor the build here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Andrew Branch (@andrewbranch)
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Angular - node (v18.15.0, x64)
Memory used295,174k (± 0.02%)295,186k (± 0.01%)~295,170k295,230kp=0.296 n=6
Parse Time2.63s (± 0.15%)2.64s (± 0.52%)~2.62s2.65sp=0.450 n=6
Bind Time0.84s (± 1.43%)0.83s (± 0.00%)-0.01s (- 1.58%)0.83s0.83sp=0.028 n=6
Check Time8.04s (± 0.10%)8.05s (± 0.19%)~8.03s8.07sp=0.236 n=6
Emit Time7.07s (± 0.36%)7.10s (± 0.46%)~7.05s7.14sp=0.243 n=6
Total Time18.59s (± 0.11%)18.61s (± 0.24%)~18.56s18.68sp=0.326 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used192,102k (± 1.23%)191,674k (± 1.24%)~190,688k196,520kp=0.575 n=6
Parse Time1.35s (± 0.77%)1.36s (± 1.29%)~1.34s1.39sp=0.391 n=6
Bind Time0.73s (± 0.00%)0.73s (± 0.00%)~0.73s0.73sp=1.000 n=6
Check Time9.15s (± 0.32%)9.14s (± 0.45%)~9.08s9.19sp=1.000 n=6
Emit Time2.62s (± 0.34%)2.63s (± 0.46%)~2.61s2.64sp=0.362 n=6
Total Time13.86s (± 0.20%)13.86s (± 0.24%)~13.81s13.89sp=0.809 n=6
Monaco - node (v18.15.0, x64)
Memory used347,349k (± 0.01%)347,356k (± 0.00%)~347,339k347,366kp=0.575 n=6
Parse Time2.46s (± 0.70%)2.45s (± 0.48%)~2.44s2.47sp=0.557 n=6
Bind Time0.94s (± 0.43%)0.94s (± 0.00%)~0.94s0.94sp=0.405 n=6
Check Time6.92s (± 0.20%)6.92s (± 0.28%)~6.89s6.94sp=0.618 n=6
Emit Time4.05s (± 0.59%)4.06s (± 0.46%)~4.03s4.08sp=0.681 n=6
Total Time14.38s (± 0.23%)14.37s (± 0.31%)~14.31s14.41sp=1.000 n=6
TFS - node (v18.15.0, x64)
Memory used302,587k (± 0.00%)302,603k (± 0.01%)~302,569k302,659kp=0.378 n=6
Parse Time2.00s (± 1.09%)2.00s (± 0.93%)~1.98s2.03sp=0.418 n=6
Bind Time1.01s (± 1.25%)1.00s (± 1.63%)~0.99s1.03sp=0.413 n=6
Check Time6.25s (± 0.40%)6.29s (± 0.53%)~6.25s6.33sp=0.075 n=6
Emit Time3.57s (± 0.33%)3.60s (± 0.39%)+0.03s (+ 0.89%)3.58s3.62sp=0.009 n=6
Total Time12.83s (± 0.27%)12.90s (± 0.25%)+0.07s (+ 0.51%)12.85s12.95sp=0.015 n=6
material-ui - node (v18.15.0, x64)
Memory used470,565k (± 0.01%)470,562k (± 0.01%)~470,521k470,600kp=0.810 n=6
Parse Time2.56s (± 0.59%)2.57s (± 0.53%)~2.56s2.60sp=0.557 n=6
Bind Time1.00s (± 0.52%)0.99s (± 0.52%)~0.99s1.00sp=0.311 n=6
Check Time16.61s (± 0.46%)16.65s (± 0.40%)~16.54s16.71sp=0.423 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time20.18s (± 0.36%)20.21s (± 0.34%)~20.10s20.28sp=0.375 n=6
xstate - node (v18.15.0, x64)
Memory used512,795k (± 0.01%)512,860k (± 0.02%)~512,748k512,985kp=0.173 n=6
Parse Time3.27s (± 0.30%)3.28s (± 0.26%)~3.26s3.28sp=0.588 n=6
Bind Time1.54s (± 0.35%)1.54s (± 0.67%)~1.53s1.56sp=0.663 n=6
Check Time2.86s (± 0.65%)2.85s (± 0.65%)~2.83s2.88sp=0.746 n=6
Emit Time0.08s (± 0.00%)0.08s (± 0.00%)~0.08s0.08sp=1.000 n=6
Total Time7.75s (± 0.30%)7.75s (± 0.25%)~7.72s7.78sp=0.571 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,376ms (± 0.76%)2,384ms (± 0.49%)~2,365ms2,398msp=0.423 n=6
Req 2 - geterr5,376ms (± 1.49%)5,370ms (± 1.32%)~5,316ms5,477msp=0.575 n=6
Req 3 - references327ms (± 1.53%)326ms (± 0.79%)~323ms329msp=0.871 n=6
Req 4 - navto277ms (± 0.98%)278ms (± 1.26%)~273ms280msp=0.620 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo83ms (± 6.89%)83ms (± 7.21%)~75ms90msp=0.869 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,502ms (± 0.58%)2,509ms (± 0.92%)~2,473ms2,540msp=0.471 n=6
Req 2 - geterr4,060ms (± 1.49%)4,090ms (± 1.61%)~4,039ms4,177msp=0.128 n=6
Req 3 - references351ms (± 6.06%)341ms (± 1.69%)~333ms347msp=0.370 n=6
Req 4 - navto282ms (± 0.72%)282ms (± 0.62%)~279ms284msp=0.655 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo84ms (± 8.11%)86ms (± 6.89%)~78ms90msp=0.391 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,586ms (± 0.25%)2,598ms (± 0.31%)+12ms (+ 0.47%)2,586ms2,610msp=0.020 n=6
Req 2 - geterr1,733ms (± 2.72%)1,750ms (± 1.80%)~1,692ms1,777msp=0.630 n=6
Req 3 - references111ms (± 8.82%)110ms (± 9.23%)~100ms122msp=0.629 n=6
Req 4 - navto368ms (± 1.18%)366ms (± 0.53%)~364ms369msp=0.570 n=6
Req 5 - completionInfo count2,073 (± 0.00%)2,073 (± 0.00%)~2,0732,073p=1.000 n=6
Req 5 - completionInfo310ms (± 1.97%)310ms (± 2.35%)~299ms317msp=0.936 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 time152.68ms (± 0.17%)152.54ms (± 0.15%)-0.14ms (- 0.09%)151.53ms154.28msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time228.15ms (± 0.15%)227.93ms (± 0.15%)-0.21ms (- 0.09%)226.69ms232.68msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time229.23ms (± 0.16%)229.19ms (± 0.16%)~227.61ms235.21msp=0.347 n=600
typescript-startup - node (v18.15.0, x64)
Execution time229.10ms (± 0.15%)229.17ms (± 0.16%)~227.77ms234.18msp=0.063 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

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test top200

@typescript-bot

TypeScript Bot (typescript-bot) commented Nov 13, 2023

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@andrewbranch), I've started to run the diff-based top-repos suite on this PR at 5546b58. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Andrew Branch (@andrewbranch) Here are the results of running the top-repos suite comparing main and refs/pull/56354/merge:

Something interesting changed - please have a look.

Details

heyxyz/hey

apps/prerender/tsconfig.json

apps/web/tsconfig.json

prisma/prisma

75 of 101 projects failed to build with the old tsc and were ignored

packages/debug/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/debug/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/get-platform/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/engines/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/engines/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/generator-helper/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/internals/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/instrumentation/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/client/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/cli/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

I’m kind of ambivalent on this. Should isolatedModules be slightly stricter than necessary and break these projects to help swc and eslint, or should these examples be used as evidence that transpilers can handle this pattern and close the issue as Working as Intended?

@jakebailey

Copy link
Copy Markdown
Member

Thinking about this from the isolatedDeclarations angle (which IIRC will require isolatedModules), this too would be a pattern we'd have to ban, I think, since it's the same problem but for the same symbol in type space?

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

I don’t think this applies to isolatedDeclarations, unless I’m missing something. The problematic question for single-file JS transpilers here is whether an import needs to be dropped. An isolatedDeclarations emitter need not ever drop an import.

@jakebailey

Copy link
Copy Markdown
Member

Ah, true; I guess I was thinking about it in terms of "can a d.ts emit reasonably understand what to export", but I guess they'd just leave things as-is.

I'm personally all for doing this break. It's only 2 out of the top 200 and the fix seems to be straightforward, right? We could rerun top500 or something to really see. That'd be fun...

TypeScript Bot (@typescript-bot) test top500

@typescript-bot

TypeScript Bot (typescript-bot) commented Nov 14, 2023

Copy link
Copy Markdown
Contributor

Heya Jake Bailey (@jakebailey), I've started to run the diff-based top-repos suite on this PR at 5546b58. You can monitor the build here.

Update: The results are in!

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

Yeah, the fix is just to make the imports type-only.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top-repos suite comparing main and refs/pull/56354/merge:

Something interesting changed - please have a look.

Details

heyxyz/hey

apps/prerender/tsconfig.json

apps/web/tsconfig.json

prisma/prisma

75 of 101 projects failed to build with the old tsc and were ignored

packages/debug/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/debug/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/get-platform/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/engines/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/engines/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/generator-helper/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/internals/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/instrumentation/tsconfig.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/client/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

packages/cli/tsconfig.build.json

  • error TS2865: Import 'Debug' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled.

vercel/commerce

tsconfig.json

@jakebailey

Copy link
Copy Markdown
Member

Yeah, given the above run I think this is okay.

@jakebaileyJake Bailey (jakebailey) left a comment

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'm going to approve it, but maybe this warrants a design meeting quick topic?

@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

Author: TeamBreaking ChangeWould introduce errors in existing codeFor Milestone BugPRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

imported symbol that is shadowed with a local symbol does not error

3 participants

@andrewbranch@typescript-bot@jakebailey