Two files in the same directory a.ts b.ts
a.ts:
const a=1;
b.ts:
const a=2;
The two files have no dependencies, I really can’t figure it out
黄舟2017-06-30 10:00:05
Because there is no import
or export
in your two files, so he thinks that your two files are global... and will naturally prompt this
淡淡烟草味2017-06-30 10:00:05
Because there is no closure in the file, each a is a global variable by default. You can use export to export a, then a becomes a variable in the closure.