aba932aefa
* Commonjs module:create synthetic exports symbol Previously, the `module` identifier in commonjs modules got a synthetic type with a single property `exports`. The exports property reused the file's symbol, which, for a module file, gives the correct exported properties. However, the name of this symbol was still the filename of the file, not `exports`. This PR creates a synthetic symbol for `exports` by copying in a similar way to esModuleInterop's `default` symbol in `resolveESModuleSymbol` (although the intent there is to strip off signatures from the symbol). * correct parent of synthetic symbol
26 lines
627 B
Plaintext
26 lines
627 B
Plaintext
=== /test.js ===
|
|
module.exports = {
|
|
>module.exports : Symbol(module.exports, Decl(test.js, 0, 0))
|
|
>module : Symbol("/test.js", Decl(test.js, 0, 0), Decl(index.ts, 0, 27))
|
|
>exports : Symbol("/test.js", Decl(test.js, 0, 0), Decl(index.ts, 0, 27))
|
|
|
|
a: "ok"
|
|
>a : Symbol(a, Decl(test.js, 0, 18))
|
|
|
|
};
|
|
|
|
=== /index.ts ===
|
|
import { a } from "./test";
|
|
>a : Symbol(a, Decl(index.ts, 0, 8))
|
|
|
|
declare module "./test" {
|
|
>"./test" : Symbol("/test.js", Decl(test.js, 0, 0), Decl(index.ts, 0, 27))
|
|
|
|
export const a: number;
|
|
>a : Symbol(a, Decl(index.ts, 3, 14))
|
|
}
|
|
|
|
a.toFixed();
|
|
>a : Symbol(a, Decl(index.ts, 0, 8))
|
|
|