/typescript_note

typescript 学习笔记

MIT LicenseMIT

# typescript_note

typescript 学习笔记

字符串属性

多行字符串

`aaa bbb ccc`

字符串模板

`i am ${myName}`

参数新特性

TypeScript-参数类型 function(a:string,b:number,c:boolean){} TypeScript-参数默认值 function(a:string,b:number,c:boolean = "yoyo"){} TypeScript-可选参数 function(a,b?){}

函数新特性

TypeScript-Rest and Spread操作符 function a(...args){} TypeScript-generator函数 function* dosomething(){ yeild } var func1 = dosomething(); func1.next(); TypeScript-析构表达式 {a,b} = {a:xx,b:yy} [a,b] = [1,2]

表达式与循环

TypeScript-箭头表达式 ()=>{}. args =>{ return a} TypeScript-for of循环 (07:16) for (a of Obj) for (a in Obj)

面向对象特性

TypeScript-类 class clazz{ private name; protected age; public weight; } TypeScript-泛型 TypeScript-接口 interface TypeScript-模块 import export TypeScript-注解 @ TypeScript-类型定义文件 .d.ts