typescript详解

类型断言
1 | const ele = document.querySelector('#canvas') as HTMLCanvasElement |
In
1 | type Fish = { swim: ()=>void } |
instansof
1 | function func(x: Date | string){ |
带属性的函数(函数签名)
1 | type IFunc = { |
泛型
1 | function doSomething<T>(a: T):T{ |
多种泛型
1 | function doSomething<T extends {length:number},B>(a: T, b: T):T // 公共属性条件约束 |
- 本文标题:typescript详解
- 本文作者:邵预鸿
- 创建时间:2025-07-17 09:54:27
- 本文链接:/images/logo.jpg2025/07/17/typescript详解/
- 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!