TypeScript/tests/baselines/reference/commonJSAliasedExport.js
Nathan Shively-Sanders c9eb62fafb
getExternalModuleMember:always resolve alias of moduleSymbol (#43718)
Previously, getExternalModuleMember passed through its received value of
`dontResolveAlias` to every function that accepted it. That includes (1)
resolution of the module symbol and (2) resolution of the module
specifier. However, in TS, the module symbol is never an alias anyway, so
dontResolveAlias doesn't make a difference. In JS, the module symbol
*can* be an alias, and it should always be resolved. That's what this PR
does.

Fixes #43713
2021-04-30 10:47:45 -07:00

43 lines
935 B
TypeScript

//// [tests/cases/conformance/salsa/commonJSAliasedExport.ts] ////
//// [commonJSAliasedExport.js]
const donkey = (ast) => ast;
function funky(declaration) {
return false;
}
module.exports = donkey;
module.exports.funky = funky;
//// [bug43713.js]
const { funky } = require('./commonJSAliasedExport');
/** @type {boolean} */
var diddy
var diddy = funky(1)
//// [commonJSAliasedExport.js]
var donkey = function (ast) { return ast; };
function funky(declaration) {
return false;
}
module.exports = donkey;
module.exports.funky = funky;
//// [bug43713.js]
var funky = require('./commonJSAliasedExport').funky;
/** @type {boolean} */
var diddy;
var diddy = funky(1);
//// [commonJSAliasedExport.d.ts]
export = donkey;
declare function donkey(ast: any): any;
declare namespace donkey {
export { funky };
}
declare function funky(declaration: any): boolean;
//// [bug43713.d.ts]
export {};