新手常遇typescript类型约束报错,是宽泛的字符串约束和具体值的类型约束的问题,使用as const
解决。原理详细如下
https://blog.csdn.net/weixin_43263355/article/details/120943605
Type ‘string‘ is not assignable to type ‘“xx1“ | “xx2“ | undefined
最新推荐文章于 2024-01-16 11:39:44 发布
新手常遇typescript类型约束报错,是宽泛的字符串约束和具体值的类型约束的问题,使用as const
解决。原理详细如下
https://blog.csdn.net/weixin_43263355/article/details/120943605