* Do not merge commonsjs exports onto an alias getCommonJSExportEquals merges export assignments and export property assignments. Something like this, which has no equivalent structure in TS: ```js module.exports = function() { } module.exports.expando = 1 ``` However, it is sometimes called with an alias, when its parent, resolveExternalModuleSymbol, is called with dontResolveAlias: true, and when the initialiser of the export assignment is an alias: ```js function alias() { } module.exports = alias module.exports.expando = 1 ``` In this case, (1) the actual value `alias` will have already merged in a previous call to getCommonJSExportEquals and (2) getTypeOfSymbol will follow the alias symbol to get the right type. So getCommonJSExportEquals should do nothing in this case. This bug manifests in the code for dynamic imports, which calls getTypeOfSymbol on the incorrectly merged alias, which now has enough value flags--Function, for example--to take the wrong branch and subsequently crash. * Update baselines
13 lines
229 B
TypeScript
13 lines
229 B
TypeScript
// @allowJs: true
|
|
// @noEmit: true
|
|
// @checkJs: true
|
|
// @target: esnext
|
|
// @module: esnext
|
|
// @Filename: bug28014.js
|
|
exports.version = 1
|
|
function alias() { }
|
|
module.exports = alias
|
|
|
|
// @Filename: importer.js
|
|
import('./bug28014')
|