随笔分类 - tyscript
tyscript
摘要:定义类 class 类名 { 属性名: 类型; constructor(参数: 类型){ this.属性名 = 参数; } 方法名(){ .... } } View Code 示例:可以使用constructor定义一个构造器方法(在TS中只能有一个构造器方法!) class C{ name: st
阅读全文
摘要:tsconfig.json 基础配置文件 { /* include:用来指定哪些ts文件需要被编译 路径:**表示任意目录 *表示任意文件 exclude:不需要被编译的文件目录 默认值:["node"] */ "include": ["./src/*"], // "exclude": ["./no
阅读全文
摘要:windows 安装 npm install -g typescript macos安装 brew install typescript 项目安装TS 除了全局安装外,也可以在项目中独立安装 typescript,这可以限定项目使用的 typescript 版本 yarn init -y 安装 ty
阅读全文