TypeScript - 配置文件 tsconfig.json
tsconfig.json 文件
tsconfig.json 文件创建两种方式:
1. 直接在根目录新建tsconfig.config.json (配置文件需要自己配置)
2. 执行tsc --init (会自动创建相关配置)
tsc --init
{
"compilerOptions": {
// target 用来指定ts被编译为的ES版本
// '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'esnext'.
"target": "ES6",
// 指定要使用的模块化的规范
// '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
"module": "System",
// library 用来指定项目中要使用的库
// 代码提示
// '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', '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.promise', 'es2020.sharedmemory', 'es202.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl','esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.
// "lib": ['dom']
// outDir 用来指定编译后文件所在的目录
"outDir": "./dist",
// outFile 将代码合并为一个文件
// 设置outFile后,所有全局作用域中的代码 会合并到同一个文件, 但是如果文件中有模块引用,则module需要改为System
// 该功能一般是打包工具来做,仅作了解,
"outFile": "./dist/app.js",
// 是否编辑js文件, 默认false
"allowJs": true,
// 是否检查js代码是否符合语法规范
// js中, let a = 10; a = 'hello'; true的情况下,会变检查
"checkJs": true,
// 是否移除注释
"removeComments": true,
// 不生成编译后的文件 即dist内的东西
"noEmit": false,
// 当有错误的时候,是否生成编译文件,避免编译错误代码
"noEmitOnError": true,
// 语法检查相关属性
// 所有严格检查的总开关, 下面的一些是否启动,即使后面的是true, 如果此处是false,同样不执行
"strict": true,
// 用来设置编译后的文件是否启用严格模式,默认false
"alwaysStrict": true,
// 否否允许隐式的any类型
// function sum(a, b){ return a + b } 此处a b就是隐式的any
"noImplicitAny": true,
//不允许不明确类型的this
// function a(){ console.log(this) }
"noImplicitThis": true,
// 是否检测null值
"strictNullChecks": true
}
}
TypeScript - 配置文件 tsconfig.json的更多相关文章
- TypeScript的配置文件 tsconfig.json
//tsconfig.json指定了用来编译这个项目的根文件和编译选项 { "compilerOptions": { //compilerOptions:编译选项,可以被忽略,这时 ...
- TypeScript 之 tsconfig.json
https://m.runoob.com/manual/gitbook/TypeScript/_book/doc/handbook/tsconfig.json.html 如果一个目录下存在一个tsco ...
- TypeScript编译tsconfig.json配置
配置预览 { "include": ["src/**/*"], "exclude": ["ndoe_modules", ...
- TypeScript tsconfig.json(TypeScript配置)
如果一个目录下存在一个tsconfig.json文件,那么意味着这个目录是TypeScript项目的根目录. tsconfig.json文件中指定了用来编译这个项目的根文件和编译选项. 一个项目可以通 ...
- tsconfig.json配置
什么工具看什么官网-一般都会有说明的 https://www.tslang.cn/docs/handbook/tsconfig-json.html 概述 如果一个目录下存在一个tsconfig.jso ...
- tsconfig.json
概述 如果一个目录下存在一个tsconfig.json文件,那么它意味着这个目录是TypeScript项目的根目录. tsconfig.json文件中指定了用来编译这个项目的根文件和编译选项. 一个项 ...
- nwjs 配置文件package.json 转载
配置文件package.json nw在启动应用程序时,首先要读取package.json文件,初始化基本属性,下面我们看看package.json的完整参数.每个参数配置都标有注释. { /**指定 ...
- [TypeScript] TypeScript对象转JSON字符串范例
[TypeScript] TypeScript对象转JSON字符串范例 Playground http://tinyurl.com/njbrnrv Samples class DataTable { ...
- 循序渐进学.Net Core Web Api开发系列【6】:配置文件appsettings.json
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.本篇概述 本篇描 ...
- The "tsconfig.json" file must have compilerOptions.sourceMap set to true
在编译ionic项目的时候出现:Error:The "tsconfig.json" file must have compilerOptions.sourceMap set to ...
随机推荐
- Jenkins Pipeline(一) - 创建一个新的pipeline
jenkins pipeline: 使用Goovy语法,以代码形式更自由地编写jenkins job. 代码文本被称为Jenkinsfile IDE: vscode 推荐安装vscode插件: jen ...
- 15. 测试环境部署-linux
抽奖项目部署文档: 1.抽奖项目使用python3开发,python版本3.x都可以 需要安装的python第三方模块 pip install django==1.9.0 这个一定要加版本号 pip ...
- HIVE- 删除功能
删除分区: ALTER TABLE table_name DROP PARTITION (partition_name='20220101');
- 「SOL」Quick Tortoise (Codeforces)
只能说没想到 题面 给出一个 \(n\times m\) 的网格图,每个格子要么是空地要么是障碍. 给出 \(q\) 个询问,每次给出 \((sx, sy),(ex,ey)\),问从 \((sx,sy ...
- NodeJS增删改查的获取方法
get獲取方法 ctx.query post獲取方法 ctx.request.body delete ctx.request.body put ctx.query ctx.request.body
- ubuntu亲测安装opencv和成功解决Makefile:160: recipe for target 'all' failed make: *** [all] Error 2
1.因为项目需要,我安装的是opencv3.0.0,从github上面下载的opencv包 git clone https://github.com/Itseez/opencv.git git clo ...
- npm ERR! Failed at the node-sass@4.14.1 postinstall script.
我们后台要了前端源代码,启动Vue项目后出现了这几行出错信息 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.14.1 p ...
- 剑指 Offer II 动态规划
088. 爬楼梯的最少成本 class Solution { public: int minCostClimbingStairs(vector<int>& cost) { int ...
- H3C交换机基本操作
Console口登录配置 1.无认证登录console <H3C>system-view [H3C]user-interface aux 0 // 进入AUX用户界面 [H3C-line- ...
- PyTorch Live get started from Windows
〇. PyTorch Live https://pytorch.org/live/docs/tutorials/get-started-manually/ 以下 命令 建议都用 以管理员身份运行的 P ...