TypeScript/tests/baselines/reference/moduleExportDuplicateAlias.errors.txt
Nathan Shively-Sanders dd1ef88d01
Use control flow to type CommonJS exports (#42751)
* 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
2021-04-06 17:07:35 -07:00

16 lines
596 B
Plaintext

tests/cases/conformance/salsa/moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'.
==== tests/cases/conformance/salsa/test.js (0 errors) ====
const { apply } = require('./moduleExportAliasDuplicateAlias')
apply()
==== tests/cases/conformance/salsa/moduleExportAliasDuplicateAlias.js (1 errors) ====
exports.apply = undefined;
function a() { }
exports.apply()
~~~~~~~~~~~~~
!!! error TS2722: Cannot invoke an object which is possibly 'undefined'.
exports.apply = a;
exports.apply()