Skip to content

Commit 1d64a9b

Browse files
committed
📝 out. Another reason to not use out
refs #206
1 parent 444c3bb commit 1d64a9b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/out.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ We do not support `--out` as we think its a bad idea for you to use because of t
99
* `_references`
1010
* Code reuse
1111
* Multiple Targets
12+
* Isolated Compile
1213

1314
## Runtime Errors
1415

@@ -76,5 +77,24 @@ If you want to reuse a portion of your code in another project, with all that *i
7677
## Multiple Targets
7778
Also if you decide to reuse your browser code in something like nodejs (e.g. for *testing* APIs) you are going to need to port it over to a module system or come up with ugly hacks to make the nodejs `global` your new global scope (i.e. `window`).
7879

80+
## Isolated Compile
81+
Files cannot be compiled in isolation. E.g. consider `a.ts`:
82+
```ts
83+
module M {
84+
var s = t;
85+
}
86+
```
87+
Will have different output depending upon whether there is a `b.ts` of the form:
88+
```ts
89+
module M {
90+
export var t = 5;
91+
}
92+
```
93+
or
94+
```ts
95+
var t = 5;
96+
```
97+
So `a.ts` [cannot be compiled in isolation](https://github.com/Microsoft/TypeScript/issues/2715).
98+
7999
## Summary
80100
`--out` is really the job of some build tool. And even such a build tool can benefit from the dependency mentions provided by external modules. So we recommend you use external modules and then let the build tool create a single `.js` for you if you so desire.

0 commit comments

Comments
 (0)