这会产生预期的错误:
type Paulo = {
prop: string,
otherValueOf: string,
}
type Treta = Record<keyof Paulo, () => Object>
const ugulha : Treta = { //Error: Property 'otherValueOf' is missing
prop: () => 1,
}
但这很好:
type Paulo = {
prop: string,
valueOf: string,
}
type Treta = Record<keyof Paulo, () => Object>
const ugulha : Treta = {
prop: () => 1,
}
可能没有人会调用道具valueOf
,但也许我缺少一些机制