मेरी प्रतिक्रिया और टाइपस्क्रिप्ट ऐप में, मैं उपयोग करता हूं onChange={(e) => data.motto = (e.target as any).value}:।
मैं कक्षा के लिए टाइपिंग को कैसे सही ढंग से परिभाषित करता हूं, इसलिए मुझे टाइप सिस्टम के साथ अपना रास्ता हैक नहीं करना होगा any?
export interface InputProps extends React.HTMLProps<Input> {
...
}
export class Input extends React.Component<InputProps, {}> {
}
अगर मैं डालूं तो target: { value: string };मुझे मिल जाएगा:
ERROR in [default] /react-onsenui.d.ts:87:18
Interface 'InputProps' incorrectly extends interface 'HTMLProps<Input>'.
Types of property 'target' are incompatible.
Type '{ value: string; }' is not assignable to type 'string'.
