TypeScript
Installation
npm i -g typescript
Usage
tsc [file] [option]
tsc <input-file> <output-file> # Ignores tsconfig.json
Options:
--allowJs
-b
,--build
-h
,--help
--init
(creates a tsconfig.json file)-m
--module <commonjs|amd|umd|system|es6|es2015|es2020|es2022|esnext|node12|nodenext>
(output, depends up ontarget
)--moduleResolution <classic|node>
(input, depends up onmodule
)--noImplicitAny <boolean>
--outDir <dir>
--outfile <file>
-p
,--project <config-file>
--removeComments
--rootDir <dir>
--strict
-t
,--target <es3|es5|es6|es2015...es2021|esnext>
--watch
More at tsc CLI Options (typescriptlang.org).
Configuration
// tsconfig.json e.g.:
{
"compilerOptions": {
"module": "ES6",
"noImplicitAny": true,
"outDir": "dist",
"removeComments": true,
"strict": true,
"target": "ES6"
},
"files": [
// ...
]
}
More at (typescriptlang.org):