[关闭]
@Dale-Lin 2022-09-14T22:58:17.000000Z 字数 923 阅读 272

tsc CLI

TypeScript


使用

tsc 命令会编译最近(向父级查找)的 tsconfig.json 定义的项目,也可以手动指定一组 glob 文件:

  1. # compile based on a backwards look through the fs
  2. tsc
  3. # Emit JS for any .ts files in the folder src with default settings
  4. tsc src/*.ts
  5. # Emit files referenced in with the compiler settings from tsconfig.production.json
  6. tsc --project tsconfig.production.json
  7. # Emit a single index.js file from two files via compiler options
  8. tsc app.ts util.ts --target esnext --outfile index.js

CLI Compiler options

只列出大部分常用的命令

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配置

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注