我无法正确输入 onchange 函数。我创建了一个处理函数,但打字稿一直抱怨类型不匹配。
我的功能:
private handleChange(options: Array<{label: string, value: number}>) {
}
Run Code Online (Sandbox Code Playgroud)
打字稿错误:
src/questionnaire-elements/AssessmentFactorSearch.tsx (43,9): Type '{ ref: "select"; name: string; backspaceToRemoveMessage: ""; value: { label: string; value: IAsse...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Async<OptionValues>> & Readonly<{ children?: React...'.
Type '{ ref: "select"; name: string; backspaceToRemoveMessage: ""; value: { label: string; value: IAsse...' is not assignable to type 'Readonly<ReactAsyncSelectProps<OptionValues>>'.
Types of property 'onChange' are incompatible.
Type '(options: { label: string; value: number; }[]) => void' is not assignable …