【发布时间】:2020-07-21 13:44:28
【问题描述】:
我创建了一个可重现的example。
我的问题是:如何使用react-final-form 修复此打字稿错误?
错误是:
Type '{ name: string; onBlur: (event?: FocusEvent<HTMLElement>) => void; onChange: (event: any) => void; onFocus: (event?: FocusEvent<HTMLElement>) => void; type?: string; value: T; checked?: boolean; multiple?: boolean; }' is not assignable to type 'T'.
'{ name: string; onBlur: (event?: FocusEvent<HTMLElement>) => void; onChange: (event: any) => void; onFocus: (event?: FocusEvent<HTMLElement>) => void; type?: string; value: T; checked?: boolean; multiple?: boolean; }' is assignable to the constraint of type 'T',
but 'T' could be instantiated with a different subtype of constraint '{}'.
点击上面的链接即可轻松查看。
我看到this 很好的答案,但我不知道如何将它应用到这个案例中。
【问题讨论】:
标签: reactjs typescript react-final-form