Skip to content

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Jan 23, 2024

Fixes #57136

Originally added in #55097, this was missing both the non-ambient check and a check that the resolved symbol has no value meaning:

  • We only issue isolatedModules errors on non-ambient code, because the goal of all isolatedModules errors to ensure that code can be transpiled to JS. Ambient code produces no JS, so it’s exempt from checks.

  • These errors are only supposed to occur when some re-export (events in the test and linked issue) resolves to something that doesn’t really exist at runtime (i.e., something that’s only a type, or something whose value meaning comes from a type-only import/export). The point is it needs to be easy for a transpiler to tell whether the re-export should be emitted or not—if it resolves to something real, it can and must be emitted; otherwise, it must be marked as type-only somewhere in the file so it can be removed.

    To try to determine if events resolved to anything real, the implementation was only checking that the re-export resolves to something with a type meaning before issuing an error. But events has both a value meaning and a type meaning (since it’s a namespace that contains one value and two types). So the implementation needed to check that the resolved symbol doesn’t also have a value meaning in order to issue an error.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jan 23, 2024
if (
sym.flags & SymbolFlags.Alias
&& resolveAlias(sym) !== unknownSymbol
Copy link
Member Author

Choose a reason for hiding this comment

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

unknownSymbol.flags === SymbolFlags.All, so while this check was necessary before, it’s now redundant with !(nonLocalMeanings & SymbolFlags.Value).

Copy link
Member

Choose a reason for hiding this comment

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

They're actually equal to All? I thought that it was SymbolFlags.Property for this symbol.

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, oops, you’re right. At any rate, it’s still redundant with !(nonLocalMeanings & SymbolFlags.Value), but I’m glad to fix that memory

export = events;

// @Filename: /boo.ts
// Bad test runner (ignores stuff when last file contains the string r-e-q-u-i-r-e)
Copy link
Member

Choose a reason for hiding this comment

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

I am definitely curious about this one... 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

The absolute worst

// We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test)
// If the last file in a test uses require or a triple slash reference we'll assume all other files will be brought in via references,
// otherwise, assume all files are just meant to be in the same compilation session without explicit references to one another.
if (testCaseContent.settings.noImplicitReferences || /require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) {

Copy link
Member

Choose a reason for hiding this comment

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

Wow, this is bogus

if (
sym.flags & SymbolFlags.Alias
&& resolveAlias(sym) !== unknownSymbol
Copy link
Member

Choose a reason for hiding this comment

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

They're actually equal to All? I thought that it was SymbolFlags.Property for this symbol.

@jakebailey
Copy link
Member

@typescript-bot test top200
@typescript-bot user test this
@typescript-bot run dt

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 23, 2024

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at f457d72. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 23, 2024

Heya @jakebailey, I've started to run the faster perf test suite on this PR at f457d72. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 23, 2024

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at f457d72. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 23, 2024

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at f457d72. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/57148/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
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,649k (± 0.01%) 295,658k (± 0.01%) ~ 295,608k 295,693k p=0.470 n=6
Parse Time 2.66s (± 0.28%) 2.66s (± 0.50%) ~ 2.64s 2.68s p=0.548 n=6
Bind Time 0.83s (± 1.25%) 0.83s (± 0.62%) ~ 0.82s 0.83s p=0.142 n=6
Check Time 8.19s (± 0.25%) 8.19s (± 0.47%) ~ 8.15s 8.24s p=0.466 n=6
Emit Time 7.10s (± 0.24%) 7.10s (± 0.19%) ~ 7.08s 7.11s p=0.676 n=6
Total Time 18.78s (± 0.16%) 18.78s (± 0.24%) ~ 18.73s 18.85s p=0.935 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 191,969k (± 0.55%) 192,552k (± 1.26%) ~ 191,485k 197,489k p=0.689 n=6
Parse Time 1.37s (± 1.07%) 1.36s (± 1.21%) ~ 1.33s 1.38s p=0.120 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.35s (± 0.59%) 9.34s (± 0.34%) ~ 9.29s 9.38s p=0.747 n=6
Emit Time 2.62s (± 0.58%) 2.63s (± 0.59%) ~ 2.61s 2.65s p=0.166 n=6
Total Time 14.05s (± 0.31%) 14.05s (± 0.18%) ~ 14.01s 14.08s p=0.808 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,460k (± 0.00%) 347,466k (± 0.00%) ~ 347,436k 347,483k p=0.521 n=6
Parse Time 2.48s (± 0.59%) 2.48s (± 0.47%) ~ 2.47s 2.50s p=1.000 n=6
Bind Time 0.93s (± 0.56%) 0.93s (± 0.68%) ~ 0.92s 0.94s p=0.386 n=6
Check Time 6.94s (± 0.58%) 6.93s (± 0.22%) ~ 6.91s 6.95s p=0.571 n=6
Emit Time 4.05s (± 0.41%) 4.06s (± 0.48%) ~ 4.04s 4.09s p=0.415 n=6
Total Time 14.39s (± 0.25%) 14.40s (± 0.19%) ~ 14.37s 14.45s p=0.807 n=6
TFS - node (v18.15.0, x64)
Memory used 302,839k (± 0.01%) 302,842k (± 0.01%) ~ 302,819k 302,896k p=0.810 n=6
Parse Time 2.02s (± 0.85%) 2.01s (± 0.81%) ~ 1.99s 2.03s p=0.287 n=6
Bind Time 1.01s (± 0.81%) 1.00s (± 1.03%) ~ 0.99s 1.02s p=0.546 n=6
Check Time 6.33s (± 0.54%) 6.32s (± 0.34%) ~ 6.29s 6.35s p=0.808 n=6
Emit Time 3.59s (± 0.73%) 3.62s (± 0.45%) ~ 3.60s 3.64s p=0.143 n=6
Total Time 12.94s (± 0.29%) 12.94s (± 0.37%) ~ 12.87s 13.00s p=1.000 n=6
material-ui - node (v18.15.0, x64)
Memory used 511,306k (± 0.00%) 511,277k (± 0.00%) ~ 511,230k 511,301k p=0.054 n=6
Parse Time 2.65s (± 0.60%) 2.65s (± 0.86%) ~ 2.63s 2.68s p=0.870 n=6
Bind Time 1.00s (± 0.75%) 1.00s (± 0.84%) ~ 0.98s 1.00s p=0.652 n=6
Check Time 17.19s (± 0.21%) 17.22s (± 0.45%) ~ 17.12s 17.31s p=0.574 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.83s (± 0.21%) 20.86s (± 0.27%) ~ 20.78s 20.92s p=0.520 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,696,405k (± 0.00%) 1,696,413k (± 0.00%) ~ 1,696,353k 1,696,438k p=0.575 n=6
Parse Time 6.54s (± 0.23%) 6.55s (± 0.66%) ~ 6.47s 6.59s p=0.462 n=6
Bind Time 2.36s (± 0.82%) 2.36s (± 0.73%) ~ 2.34s 2.39s p=0.744 n=6
Check Time 55.59s (± 0.50%) 55.45s (± 0.42%) ~ 55.14s 55.74s p=0.521 n=6
Emit Time 0.16s (± 0.00%) 0.16s (± 0.00%) ~ 0.16s 0.16s p=1.000 n=6
Total Time 64.65s (± 0.43%) 64.52s (± 0.40%) ~ 64.22s 64.87s p=0.689 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,413,432k (± 0.03%) 2,413,410k (± 0.04%) ~ 2,412,350k 2,414,357k p=0.936 n=6
Parse Time 4.95s (± 0.49%) 4.92s (± 1.14%) ~ 4.86s 4.99s p=0.471 n=6
Bind Time 1.87s (± 0.89%) 1.88s (± 1.03%) ~ 1.84s 1.89s p=0.363 n=6
Check Time 33.45s (± 0.38%) 33.45s (± 0.45%) ~ 33.25s 33.66s p=0.810 n=6
Emit Time 2.67s (± 1.23%) 2.72s (± 1.33%) +0.05s (+ 1.75%) 2.68s 2.78s p=0.045 n=6
Total Time 42.98s (± 0.34%) 42.99s (± 0.41%) ~ 42.77s 43.21s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Memory used 419,704k (± 0.01%) 419,754k (± 0.01%) ~ 419,671k 419,847k p=0.093 n=6
Parse Time 2.72s (± 3.34%) 2.75s (± 2.81%) ~ 2.66s 2.82s p=0.573 n=6
Bind Time 1.18s (± 6.60%) 1.14s (± 6.65%) ~ 1.07s 1.23s p=0.413 n=6
Check Time 15.14s (± 0.47%) 15.13s (± 0.45%) ~ 15.02s 15.22s p=0.872 n=6
Emit Time 1.16s (± 1.67%) 1.15s (± 0.90%) ~ 1.13s 1.16s p=0.192 n=6
Total Time 20.19s (± 0.42%) 20.16s (± 0.31%) ~ 20.09s 20.27s p=0.688 n=6
vscode - node (v18.15.0, x64)
Memory used 2,808,007k (± 0.00%) 2,807,956k (± 0.00%) ~ 2,807,853k 2,808,019k p=0.128 n=6
Parse Time 10.62s (± 0.37%) 10.61s (± 0.28%) ~ 10.56s 10.65s p=0.221 n=6
Bind Time 3.39s (± 0.42%) 3.39s (± 0.43%) ~ 3.37s 3.41s p=0.870 n=6
Check Time 59.65s (± 0.44%) 59.95s (± 0.45%) ~ 59.71s 60.39s p=0.090 n=6
Emit Time 16.13s (± 0.35%) 16.18s (± 0.54%) ~ 16.06s 16.29s p=0.336 n=6
Total Time 89.80s (± 0.29%) 90.13s (± 0.35%) ~ 89.71s 90.54s p=0.109 n=6
webpack - node (v18.15.0, x64)
Memory used 392,529k (± 0.01%) 392,553k (± 0.02%) ~ 392,468k 392,620k p=0.298 n=6
Parse Time 3.05s (± 0.94%) 3.05s (± 0.56%) ~ 3.02s 3.07s p=0.504 n=6
Bind Time 1.39s (± 0.99%) 1.40s (± 0.29%) ~ 1.39s 1.40s p=0.796 n=6
Check Time 13.95s (± 0.20%) 13.96s (± 0.31%) ~ 13.91s 14.02s p=1.000 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.39s (± 0.29%) 18.41s (± 0.25%) ~ 18.36s 18.48s p=0.572 n=6
xstate - node (v18.15.0, x64)
Memory used 513,393k (± 0.01%) 513,397k (± 0.01%) ~ 513,344k 513,431k p=1.000 n=6
Parse Time 3.28s (± 0.31%) 3.29s (± 0.25%) ~ 3.27s 3.29s p=0.149 n=6
Bind Time 1.54s (± 0.26%) 1.54s (± 0.00%) ~ 1.54s 1.54s p=0.405 n=6
Check Time 2.86s (± 0.65%) 2.84s (± 0.35%) ~ 2.83s 2.85s p=0.217 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 6.19%) ~ 0.08s 0.09s p=0.174 n=6
Total Time 7.75s (± 0.16%) 7.75s (± 0.18%) ~ 7.73s 7.76s p=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)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/57148/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

@andrewbranch andrewbranch merged commit 94f4379 into microsoft:main Jan 24, 2024
@andrewbranch andrewbranch deleted the bug/57136 branch January 24, 2024 20:03
@andrewbranch
Copy link
Member Author

@typescript-bot cherry-pick to release-5.4

@typescript-bot
Copy link
Collaborator

Heya @andrewbranch, I've started to cherry-pick this into release-5.4 for you. Here's the link to my best guess at the log.

@typescript-bot
Copy link
Collaborator

Hey @andrewbranch, I've created #57161 for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.4 breaks @types/node when using isolatedModules
4 participants