@Dale-Lin
2022-09-14T22:58:17.000000Z
字数 923
阅读 272
TypeScript
tsc
命令会编译最近(向父级查找)的 tsconfig.json
定义的项目,也可以手动指定一组 glob 文件:
# compile based on a backwards look through the fs
tsc
# Emit JS for any .ts files in the folder src with default settings
tsc src/*.ts
# Emit files referenced in with the compiler settings from tsconfig.production.json
tsc --project tsconfig.production.json
# Emit a single index.js file from two files via compiler options
tsc app.ts util.ts --target esnext --outfile index.js
只列出大部分常用的命令
flag | type | explain |
---|---|---|
--all | boolean | show all compiler options |
--help | boolean | help |
--init | boolean | init a ts project includes a tsconfig.json file |
--project | string | compile the project given the path to its configuration file, or to a folder with tsconfig.json |
build options
flag | type | explain |
---|---|---|
--build | boolean | build one or more projects and their dependencies, if out of date |
--clean | boolean | delete the output of all projects |
--dry | boolean | show what would be built or delete |
--force | boolean | build all projects including those that appear to be up to date |
其他可通过 tsconfig.json 配置的 compiler options 见另一篇文章:TS配置