You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that since bar.ts doesn't have any imports or exports, it is not a module, so the Person class becomes global. This behavior makes sense in a browser, but not in a Node.js application. There should be a compiler flag which forbids this behavior and produces a Cannot find name 'Person' error.
The text was updated successfully, but these errors were encountered:
The following code compiles in TypeScript but running the compiled output under Node.js results in an error:
Contents of foo.ts:
Contents of bar.ts:
Contents of tsconfig.json:
My understanding is that since
bar.ts
doesn't have any imports or exports, it is not a module, so thePerson
class becomes global. This behavior makes sense in a browser, but not in a Node.js application. There should be a compiler flag which forbids this behavior and produces aCannot find name 'Person'
error.The text was updated successfully, but these errors were encountered: