# ts 笔记

# tsconfig 配置

# compilerOptions

# lib: 所有需要的类库
# target: 所需要编译的目标选项
# module: 编译后的代码规范 (默认 cjs)
# moduleResolution: 模块解析, moduleResolution :'node' import 文件从内到外的目录查找,moduleResolution : 'classic' import 文件从外层到内层方式查找
# resolveJsonModule: true,允许引入 json
# allowJs: true,允许引入 js 文件,同时将内容编译到目标文件内
# checkJs: true,检测 js 语法
# declaration: true, 生成.d.ts 文件
# sourceMap: true,生成 sourcemap 文件
# noImplicitAny: true,对 any 进行严格检查
# strictNullChecks: true,对 null 和 undefined 严格检查,不能赋值给基础类型
# strictPropertyInitialization:true,严格属性要有初始值
# noImplicitReturns: true, 函数没有返回值会报错
# removeComments: true, 编译后删除注释
# noUnusedLocals: true, 变量未使用报错
# skipLibCheck: true,跳过声明文件 d.ts 的检查
# typeRoots/types : 设置第三方包类型的路径
# baseUrl: 设置工程目录
# path: 定义路径的映射
# include: 定义 ts 文件范围,包含 d.ts 类型文件
# experimentalDecorators: true,支持装饰器,消除警告
# emitDecoratorMetadata: true,支持元数据装饰器,消除警告