类型注解和类型推断
摘要:一、类型注解 type annotation ,类型注解,通过类型注解告诉TS变量是什么类型 二、类型推断 TS会尝试分析变量的类型,如果TS能够自动分析变量类型,我们就什么都不需要做了,如果TS无法分析变量类型的话,我们就需要使用类型注解。 const str1= 'a'; const str2
阅读全文
posted @ 2021-10-26 23:01
posted @ 2021-10-26 23:01
posted @ 2021-10-24 22:08
posted @ 2021-10-24 20:40