摘要:
// 类型别名 type PlusType = (x:number,y:number)=>number function sum(x:number,y:number):number{ return x+y } const sum2:PlusType = sum type NameResolver = 阅读全文
posted @ 2020-12-10 20:08
chenlw101
阅读(329)
评论(0)
推荐(0)
摘要:
function echo<T>(arg:T):T{ return arg } const result = echo("str") function swap<T,U>(arr:[T,U]):[U,T]{ return [arr[1],arr[0]] } const result1 = swap( 阅读全文
posted @ 2020-12-10 19:56
chenlw101
阅读(74)
评论(0)
推荐(0)
摘要:
const enum Direction { Up='Up', Down="Down", Left="Left", Right="Right" } console.log(Direction.Up) 阅读全文
posted @ 2020-12-10 19:06
chenlw101
阅读(54)
评论(0)
推荐(0)
摘要:
interface Radio{ switchRadio(triggrL:boolean):void; } interface Bettery{ checkBettery(); } interface RadioAndBettery extends Radio{ checkBettery(); } 阅读全文
posted @ 2020-12-10 18:58
chenlw101
阅读(97)
评论(0)
推荐(0)
摘要:
class Person { // 默认public //private私有,不可访问 //protected子类可以访问,外部不可以访问 // readonly 只可读,不可写 // static 静态属性 当类的定义与实例状态没有太大关系的时候使用 protected name:string; 阅读全文
posted @ 2020-12-10 17:33
chenlw101
阅读(52)
评论(0)
推荐(0)
摘要:
interface Person { readonly id:number; name:string; age?:number; } function add(x:number=2,y:number,z?:number):number{ if(typeof z "number"){ return x 阅读全文
posted @ 2020-12-10 17:09
chenlw101
阅读(989)
评论(0)
推荐(0)
摘要:
let isDone:boolean = true let age:number = 123 let newName:string = "aaa" let u:undefined = undefined let n:null = null; let uDemo:number=null let uDe 阅读全文
posted @ 2020-12-10 17:04
chenlw101
阅读(83)
评论(0)
推荐(0)
浙公网安备 33010602011771号