-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix isolatedModules check for export assignments #57148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if ( | ||
sym.flags & SymbolFlags.Alias | ||
&& resolveAlias(sym) !== unknownSymbol |
There was a problem hiding this comment.
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)
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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... 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The absolute worst
TypeScript/src/testRunner/compilerRunner.ts
Lines 238 to 242 in 25a4f9e
// 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)) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
@typescript-bot test top200 @typescript-bot perf test this faster |
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! |
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! |
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! |
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! |
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @jakebailey, the results of running the DT tests are ready. |
@jakebailey Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
@typescript-bot cherry-pick to release-5.4 |
Heya @andrewbranch, I've started to cherry-pick this into |
Hey @andrewbranch, I've created #57161 for you. |
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. Butevents
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.