摘要:
// 类型别名 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
阅读(321)
推荐(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
阅读(64)
推荐(0)
编辑
摘要:
const enum Direction { Up='Up', Down="Down", Left="Left", Right="Right" } console.log(Direction.Up)
阅读全文
posted @ 2020-12-10 19:06
chenlw101
阅读(43)
推荐(0)
编辑
摘要:
interface Radio{ switchRadio(triggrL:boolean):void; } interface Bettery{ checkBettery(); } interface RadioAndBettery extends Radio{ checkBettery(); }
阅读全文
posted @ 2020-12-10 18:58
chenlw101
阅读(90)
推荐(0)
编辑