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
import{b1}from'./b';console.log(b1());// NO ERROR (as expected)console.log(b2());// ERROR (as expected)console.log(c1());// NO ERROR (an error is expected here)
Expected behavior:
Referring to c1 from a.ts should be an error.
Actual behavior:
No error regarding c1 in a.ts.
Comment
From the description of --isolatedModules "transpile each file as a separate module" I do not expect types from any file to be visible that I haven't explicitly imported (unless they're coming in through compilerOptions.types or something like that). I get it with --isolatedModules the disposition of c1.ts is basically completely invalid. However, this behavior is very confusing particularly when migrating code bases where there might be a lot of code laying around that hasn't been refactored yet.
Is the unexpected behavior coming from the old internal module system?
The text was updated successfully, but these errors were encountered:
By the way also seeing a lot of error TS2393: Duplicate function implementation. errors caused by using the same function name in multiple files, which shouldn't be a problem if the expectation is that each file is completely isolated from each other.
That is not the intention of this flag. the flag ensures that each file can be transpiled in isolation. i.e. the behavior of the emit does not depend on having full program. an example of that is const enums, whose element values are inlined at use sites.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.4.2
tsconfig.json
a.ts
b.ts
c.ts
Expected behavior:
Referring to
c1
froma.ts
should be an error.Actual behavior:
No error regarding
c1
ina.ts
.Comment
From the description of
--isolatedModules
"transpile each file as a separate module" I do not expect types from any file to be visible that I haven't explicitly imported (unless they're coming in throughcompilerOptions.types
or something like that). I get it with--isolatedModules
the disposition ofc1.ts
is basically completely invalid. However, this behavior is very confusing particularly when migrating code bases where there might be a lot of code laying around that hasn't been refactored yet.Is the unexpected behavior coming from the old internal module system?
The text was updated successfully, but these errors were encountered: