Node Target Mapping · microsoft/TypeScript Wiki · GitHubTypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Node Target Mapping · microsoft/TypeScript Wikihttps://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping以上是tsconfig.json的针对不同nodejs版本的关键参数配置
Node 16
{ "compilerOptions": { "lib": ["ES2021"], "module": "commonjs", "target": "ES2021" } }
Node 14
{ "compilerOptions": { "lib": ["ES2020"], "module": "commonjs", "target": "ES2020" } }
Node 12
{ "compilerOptions": { "lib": ["ES2019"], "module": "commonjs", "target": "ES2019" } }
Node 10
{ "compilerOptions": { "lib": ["es2018"], "module": "commonjs", "target": "es2018" } }
Node 8
{ "compilerOptions": { "lib": ["es2017"], "module": "commonjs", "target": "es2017" } }