TS类型体操

2023年10月10日236 次阅读0 人喜欢
技术ts

常用类型记录

提取对象的keys作为另外一个固定类型对象的可选keys

常用语从data字段提取出keys,作为rules字段

typescript 复制代码
import type { FormItemRules } from 'element-plus'

interface A {
  name:string
  id:string
  label?:value
}

type Partial <O={},V=any>  =  Partial<Record<keyof O,V>>

type ARules = Partial<A,FormItemRules| FormItemRules[]>

评论

加载中...
TS类型体操 | 博客