前言
Base: vue@3.2.33 + typescript@4.1.6 + npm@8.5.0
尝试解决将ts中自定义的interface/type,传vue的props属性的问题。 记录一下过程和思路。
一、问题定位
官方文档中说,props自定义类型检查是可能的。
In addition, type can also be a custom class or constructor function and the assertion will be made wi
TypeScript中Record<string,any>是啥?现在让我们来了解一下TypeScript官方的内置类型,让你的开发效率再上一层楼
Partial(部分的)
/**
* Make all properties in T optional
*/
type Partial<T> = {
[P in keyof T]?: T[P];
};
作用是让传入类型中的所有属性变成都是可选的