摘要: // JS 中定义函数的方式 function hell(){} const hello1 = function(){} const hello2 = () => {} // TS 中定义函数的方式 // 参数需要类型注解,返回值不需要 function add(first: number, sec 阅读全文
posted @ 2020-05-27 20:18 wzndkj 阅读(190) 评论(0) 推荐(0) 编辑
摘要: // type annotation 类型注解,我们来告诉 TS 变量是什么类型 // type inference 类型推断,TS 会自动的去尝试分析变量的类型 // 如果 TS 能够自动分析变量类型,我们就什么也不需要做了 // 如果 TS 无法分析变量类型的话,我们就需要使用类型注解 let 阅读全文
posted @ 2020-05-27 06:24 wzndkj 阅读(914) 评论(0) 推荐(0) 编辑