Contents of foo.ts:
let a: Person = new Person();
Contents of bar.ts:
class Person {}
The tsconfig.json file contains the default set of values created by tsc --init
.
I'm using typescript version 2.6.2.
The code above simply compiles with no errors about Person
being not defined. If I rename Person
to Persons
in foo.ts, then it does throw an error saying cannot find name 'Persons'
. So it's as if it is automatically importing this file somehow.
Also note that I'm not exporting the Person
class in bar.ts. If I do add an export statement, then everything behaves as it should - I get an error saying cannot find name 'Person'
.
Does anyone know what's going on here? Is this a user error?
Edit:
Maybe this makes sense in the browser, but to me this behavior makes no sense in a node.js application. Is there a Typescript flag which forbids this behavior?