小工具知识网

当前位置: 首页 > 行业知识 > TypeScript的tsconfig.json文件相关配置

行业知识

TypeScript的tsconfig.json文件相关配置

2026-12-01 19:58:43 来源:互联网转载

首先需要在���建一个tsconfig.json文件

 

{    /*    include表示指定编译ts目录下的ts文件        路径:            **表示任意目录            *表示任意文件    * exclude表示被排除的编译文件    * extends表示需要继承的文件    * files表示指定编译的文件列表    */    "include": [        "ts/**/*"    ],    "exclude": [        "ts/hh/**/*"    ],    "compilerOptions": {            // target用来指定被编译的ES版本 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'        "target": "ES6",            // module用来指定要是用的模块化规范 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.        "module": "system",            // lib用来指定项目中使用的语法库 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018',             // 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker',            //  'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection',             // 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol',            //  'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string',            //  'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl',             // 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol',             // 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown',            //  'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array',             // 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol',             // 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.        // "lib": ["DOM"],            // outDir用来指定编译后所存放的目录文件        "outDir": "./dist",            // outfile用来将全局作用域代码进行合并        "outFile": "./dist/content.js",            // allowJs是否编译js文件,默认为false        "allowJs": true,            // checkJs是否检验js代码符合ts语法规范        "checkJs": false,            // removeComments是否移除文本注释        "removeComments": true,            // noEmit不生成编译后的文件        "noEmit": false,            // noEmitOnError当语法有错误时不生成编译文件        "noEmitOnError": true,            // strict是以下严格检查的总开关        "strict": true,            // alwaysStrict用来设置编译后的文件是否使用严格模式        "alwaysStrict": true,            // noImplicitAny不允许使用隐式any,any等同于关闭了ts数据类型检测,所以不推荐使用any        "noImplicitAny": true,            // noImplicitThis不允许不明确类型的this        "noImplicitThis": true,            // strictNullChecks严格检查空值        "strictNullChecks": true,    }}

 

 

上一篇:南海领先网站建设公司,卓越互联网体验的专业团队引领未来

下一篇:淘宝客怎么采集信息吗?