Back to questions
JuniorTheoryCommon
What does tsc report for a file made of these two lines only?
const name = "Аня";
console.log(name);An error: the name name is already declared
- Expecting every file to keep its names to itself: a file with no
importorexportis a script, and itsconst nameclashes with the browser's globalname. - Expecting
tscto look at this file alone: it also knows the browser's global names fromlib.dom.d.ts, and a script'snameclashes with one of them.
- How do you turn this file into a module without exporting anything?
- Why does the same pair of lines compile in a file that has an
import?