typescript 解决变量多类型访问属性报错--工作随记

一个变量类型允许是多个类型,如果访问某个类型的属性,编辑器会直接提示错误 比如 变量 tuple 可能为string 或 number 类型,如果直接访问tuple.toFixed const mixedTupleTypeArray: (string|number)[] = ['hello', 23
posted @ 2023-03-06 19:00  池中物王二狗  阅读(73)  评论(0编辑  收藏  举报
转载入注明博客园 王二狗Sheldon Email: willian12345@126.com https://github.com/willian12345