约束一个类型中,假设规定了其他固定类型,要求用户传递其他规范时增加约束,比如,key 以 End 结尾。
type C={
name:string
[key:`${string}End`]:string | number
age?:number
}
//即
const type:C={
name:"safajfs"
ioEnd:"asd"
}
约束一个类型中,假设规定了其他固定类型,要求用户传递其他规范时增加约束,比如,key 以 End 结尾。
type C={
name:string
[key:`${string}End`]:string | number
age?:number
}
//即
const type:C={
name:"safajfs"
ioEnd:"asd"
}