joken-前端工程师

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: :: 管理 ::

2024年6月24日

摘要: 代码 联合类型、交叉类型 //联合类型 type abcNewType = string | number; type abcNewType2 = "a" | "b" | "c"; interface a1 { a: string } interface a2 { b: string } //交叉类 阅读全文
posted @ 2024-06-24 22:12 joken1310 阅读(2) 评论(0) 推荐(0) 编辑

摘要: 代码 interface 方式 interface myFn7 { (a: string, b: string): string; } let myFn7Demo: myFn7 = function (a: string, b: string): string { return a + b; } c 阅读全文
posted @ 2024-06-24 20:51 joken1310 阅读(1) 评论(0) 推荐(0) 编辑

摘要: 概论 declare是声明全局类型的a56爆大奖在线娱乐方式 declare 关键字用来告诉编译器,某个类型是存在的,可以在当前文件中使用。 测试代码 测试了type 和 function 声明代码 declare type myGlobalNumber=number; //注意这里的function 是个值,不是 阅读全文
posted @ 2024-06-24 20:36 joken1310 阅读(2) 评论(0) 推荐(0) 编辑