* Allow redeclaring CommonJS alias with initial undefined This allows us to read our own output, plus the times when people manually write exactly the same pattern. Fixes #40555 * Use control flow to type commonjs exports 1. Could probably use a *lot* more tests. 2. getTypeOfAlias redoes some work from resolveAlias because it needs to not resolve the alias completely, just to its export. * fix lint, improve jsdoc * Add tests, improve+fix control flow 1. Update the module.exports test to match the exports ones. 2. Add a test of evolving commonjs type. 3. Add a test of assignment as last statement. (1) exposed a bug that required a better synthetic reference. (3) exposed a bug that was most easily fixed by giving source files a `endFlowNode` like functions and setting it in the binder. * fix lint
18 lines
421 B
TypeScript
18 lines
421 B
TypeScript
// @checkJs: true
|
|
// @strict: true
|
|
// @declaration: true
|
|
// @filename: moduleExportAliasDuplicateAlias.js
|
|
// @outdir: out
|
|
exports.apply = undefined;
|
|
exports.apply = undefined;
|
|
function a() { }
|
|
exports.apply = a;
|
|
exports.apply()
|
|
exports.apply = 'ok'
|
|
var OK = exports.apply.toUpperCase()
|
|
exports.apply = 1
|
|
|
|
// @filename: test.js
|
|
const { apply } = require('./moduleExportAliasDuplicateAlias')
|
|
const result = apply.toFixed()
|