TypeScript工具类型
TypeScript实用工具
全局工具
异步
Awaited
type A = Awaited<Promise<string>>;
// A = string;
type A = Awaited<Promise<Promise<number>>>;
// A = string;
type A = Awaited<string>
// A = string;
type A = Awaited<boolean | Promise<number>>;
// A = boolean | number对象属性转换
Partial
Required
Readonly
根据条件构造对象类型
Record<Keys,Type>
Pick<Type, Keys>
Omit<Type, Keys>
联合类型
Exclude<UnionType, ExcludedMenbers>
Extract<Type, Union>
NonNullable
函数
Parameters
ReturnType
ConstructorParameters
InstanceType
ThisParameterType
OmitThisParameter
字符串
最后更新于