摘要: function add2(first: number, second: number) { return first + second + ""; } function add(first: number, second: number): number { return first + seco 阅读全文
posted @ 2021-05-25 23:32 sinceForever 阅读(43) 评论(0) 推荐(0) 编辑
摘要: type annotation 类型注解,我们告诉 ts 是什么类型type inference 类型推断, ts 自动尝试分析变量类型,如果 ts 能自动分析类型我们就什么都不需要做,如果不能我们就需要使用类型注解 let count: number; //类型注解,直接声明类型 count = 阅读全文
posted @ 2021-05-25 23:31 sinceForever 阅读(572) 评论(0) 推荐(0) 编辑
摘要: // 基础类型 null, undefined,symbol, boolean,void const count: number = 1123; const teachername: string = "ll"; // 对象类型 const teacher: { name: string, age: 阅读全文
posted @ 2021-05-25 23:29 sinceForever 阅读(65) 评论(0) 推荐(0) 编辑