2022年12月13日

TypeScript 基础类型的使用,类型断言的使用

摘要: //使用unknown,可以给变量添加任何的类型值 //在使用时必须需要断言如下 let e:unknown; e = 'hello' let s :string; //断言的三种方式 //方式一 if(typeof e 'string'){ s = e console.log(s); } //方式 阅读全文

posted @ 2022-12-13 16:33 totau 阅读(44) 评论(0) 推荐(0) 编辑

导航