TypeScript is designed for large-scale JavaScripty projects which typically consist of multiple internally produced files along with externally produced libraries. How does the TypeScript compiler (tsc) expect you to provide it with the complete set of files that make up a project?
相关问题
- Angular RxJS mergeMap types
- void before promise syntax
- Ignore Typescript errors in Webpack-dev-server
- Angular: ngc or tsc?
- Angular: ngc or tsc?
相关文章
- Cannot find module 'redux' 怎么解决?
- How to get a Component's own ElementRef for re
- 'Pick' only refers to a type, but is being
- Why does `keyof any` have type of `string | number
- React testing library: Test attribute / prop
- TypeScript - Puppeteer library error: “Cannot find
- How to reference type of self in Typescript interf
- React and typescript with webpack typing issue
Or simply:
If someone needs multiple files pretranspiled before the actual project compiling, use a separate tsconfig with the --project compiler option.
One use case would be the need of the resulting JS files used afterwards in command line arguments for ionic app scripts.
This will compile all
*.ts
files in working directory and its sub directories. If you don't want to include sub directories, just remove the/s
part from the first line.Note that you can also add other arguments to the
tsc
line. Here is what I'm using now for one of my projects:In case anyone needs this for Mac OS X:
tsc can compile multiple sources in sequence if you just give the names in order:
You can also pass a text file containing a list of files and command line arguments from a text file using the
@
command line argument.and the
compile.txt
could look like this:Also note that if on file references another via an
import
,tsc
will automatically figure that out without you having to explicitly list the file that it depends on.With TypeScript 1.5 (beta but the final version should be there soon), you can create a tsconfig.json file to configure the TypeScript compiler and the files to compile (among other things). See my answer over there: How to watch and compile all TypeScript sources?