Make the implicitly exported rule consistent between checker and binder - #54659
Conversation
|
Heya Gabriela Araujo Britto (@gabritto), I'm starting to run the parallelized Definitely Typed test suite on this PR at 777e7be. Hold tight - I'll update this comment with the log link once the build has been queued. |
|
Well, I guess the bot still isn't working, so we'll have to wait to see what this PR breaks in DT. |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the parallelized Definitely Typed test suite on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Hey Gabriela Araujo Britto (@gabritto), the results of running the DT tests are ready. Branch only errors:Package: react-relay Package: react-relay/v7 Package: relay-runtime Package: jsonld Package: relay-test-utils |
|
TypeScript Bot (@typescript-bot) test this pretty please |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based user code test suite on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based top-repos suite (tsserver) on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the extended test suite on this PR at 777e7be. You can monitor the build here. |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the perf test suite on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based user code test suite (tsserver) on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Heya Gabriela Araujo Britto (@gabritto), I've started to run the diff-based top-repos suite on this PR at 777e7be. You can monitor the build here. Update: The results are in! |
|
Gabriela Araujo Britto (@gabritto) Here are the results of running the user test suite comparing Everything looks good! |
|
Gabriela Araujo Britto (@gabritto) 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
|
|
I am moderately suspicious that the user tests didn't net anything, but maybe that's to be expected if this only happened in ambient contexts. (I guess top100 is still running) |
|
Gabriela Araujo Britto (@gabritto) Here they are:
CompilerComparison Report - main..54659
System
Hosts
Scenarios
TSServerComparison Report - main..54659
System
Hosts
Scenarios
StartupComparison Report - main..54659
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Gabriela Araujo Britto (@gabritto) Here are the results of running the top-repos suite comparing Everything looks good! |
1 similar comment
|
Gabriela Araujo Britto (@gabritto) Here are the results of running the top-repos suite comparing Everything looks good! |
|
|
||
| const enum ContainerFlags { | ||
| /** @internal */ | ||
| export const enum ContainerFlags { |
There was a problem hiding this comment.
I'm not experienced enough to know the right way to do this, but it does feel a little suspicious to export... I feel like I've seen a function that does something similar in the checker but I can't recall the name.
There was a problem hiding this comment.
I wanted to make sure the container used to check the implicit export rules is precisely the same the binder uses, and the binder uses those flags for that... I saw a getContainerNode in services/utilities, and getEnclosingBlockScopeContainer in compiler/utilities, but those are different.
|
For me or anyone else in the future: the declare module 'replace-in-file' {
export function replaceInFile(config: unknown): Promise<unknown[]>;
export {};
namespace replaceInFile {
export function sync(config: unknown): unknown[];
}
}introduces the same issue. In an ambient module, adding an TypeScript now recognizes these unfortunately confusing semantics more consistently, and issues an error on the fact that all declarations of In the case where there is no declare module 'replace-in-file' {
export function replaceInFile(config: unknown): Promise<unknown[]>;
namespace replaceInFile {
export function sync(config: unknown): unknown[];
}
} |
Fixes #54342.
In the binder, when deciding if a declaration should be treated as exported or not, we consult the declaration container's flags to see if it is an "export context", meaning an ambient context where declarations are implicitly exported. In the checker, however, we treat everything in an ambient context as exported, regardless of whether we're in an ambient context where declarations are implicitly exported, resulting in us incorrectly not erroring on the
.d.tsfile present in #54342.