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 ...
随机推荐
- Oracle查询表中的各列的列名,数据类型,以及类型长度
SELECT table_name, column_name, data_type,data_length FROM all_tab_cols WHERE table_name = UPPER('ba ...
- 关于精准UWB人员定位系统解决方案
WB技术, 目前主要应用在室内定位.人员定位系统等定位领域.近年来被应用在无线定位和雷达测距应用中,因此作为民用雷达和民用测距取得了较快的发展.而今天,我们主要要来介绍的产品就是UWB技术的芯片DW1 ...
- 「SOL」JOISC2021 解题报告
JOIS(egment-Tree)C 1. 前言 很早之前教练让我们做这套题,我以为这套题应该挺简单,用几天的空余时间就能刷完,结果预想的短周期刷题变成了长周期刷题--(好像是整个团队里最后一个刷完的 ...
- 实验1task4
<实验结论> #include <stdio.h> #include <stdlib.h> int main() { int x, t, m; x = 123; p ...
- Java Swing 防止键入手Key 的实现方法
实现思路,启动一个线程每隔0.1秒去比较文本里字符长度变化,如果文本变长了,这个情况间隔时间超过2秒,则认为是人工键入. 对于字符串较多,且包含数字和字母的情况,比较适用. class KeyCode ...
- C# 当页面有很多选择条件时的处理方式
如下图,用户可能输入很多条件 在后端的处理方式: 使用键值对 private Dictionary<string, string> CreatSearchPara() { Dictiona ...
- JS中函数的length以及arguments的length如何得到?
function a(x,y){} a.length // 2 function b(x,y=2,z){} b.length // 1 function c(x,...args){} c.length ...
- Gradle 安装配置
1 下载 官网各版本下载地址如下: https://gradle.org/releases/ 2 安装 将下载后的压缩包(此处以 gradle-6.5-all.zip 为例)解压到某个目录进行安装. ...
- js——带暂停、启动功能的定时
简单的封装,将 interval 二次封装,对外提供暂停.启动功能. 不足之处:interval定时间隔是固定的,在调用异步函数的时候,可能会出现bug.例如:在调用ajax异步请求过程中,发送a.b ...
- Centos 7 安装RabbitMq 3.10.7
1:准备工作 rabbitmq官网查看erlang和rabbitmq的版本关联关系,这里选择 erlang版本:otp_src_25.0 rabbitmqserver版本:3.10.7 官网下载对应 ...