TypeScript/tests/baselines/reference/commonJSImportClassTypeReference.types
Nathan Shively-Sanders e350c357d2
Alias for module.exports.x = x (#40228)
* Alias for `module.exports.x = x`

This fixes #40155 in a surprisingly small amount of code.

* Treat any aliasable expression as an alias

* test internal references to exported class
2020-09-10 11:23:48 -07:00

39 lines
695 B
Plaintext

=== tests/cases/conformance/salsa/main.js ===
const { K } = require("./mod1");
>K : typeof K
>require("./mod1") : typeof import("tests/cases/conformance/salsa/mod1")
>require : any
>"./mod1" : "./mod1"
/** @param {K} k */
function f(k) {
>f : (k: K) => void
>k : K
k.values()
>k.values() : K
>k.values : () => K
>k : K
>values : () => K
}
=== tests/cases/conformance/salsa/mod1.js ===
class K {
>K : K
values() {
>values : () => K
return new K()
>new K() : K
>K : typeof K
}
}
exports.K = K;
>exports.K = K : typeof K
>exports.K : typeof K
>exports : typeof import("tests/cases/conformance/salsa/mod1")
>K : typeof K
>K : typeof K