You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the compile error in using it in TypeScript.
I found out type mismatch between getInputRef and inputRef that passed from material-ui.
I want to make type restriction of getInputRef lax for solving this problem.
Problem:
<NumberFormat
getInputRef={inputRef}
value={value as number}
onValueChange={(values) => {
if (onChange === undefined) {
return;
}
const event = {
target: {
value: values.value,
},
} as React.ChangeEvent<HTMLInputElement>;
onChange(event);
}}
/>
error:
TS2326: Types of property 'getInputRef' are incompatible.
Type 'string | ((instance: any) => any) | RefObject<any> | undefined' is not assignable to type '((el: HTMLInputElement) => void) | undefined'.
Type 'string' is not assignable to type '((el: HTMLInputElement) => void) | undefined'.
Workarround:
<NumberFormat
getInputRef={inputRef as (el: HTMLInputElement) => void}
value={value as number}
onValueChange={(values) => {
if (onChange === undefined) {
return;
}
const event = {
target: {
value: values.value,
},
} as React.ChangeEvent<HTMLInputElement>;
onChange(event);
}}
/>
The text was updated successfully, but these errors were encountered:
Hello.
I am using this module with material-ui.
I got the compile error in using it in TypeScript.
I found out type mismatch between getInputRef and inputRef that passed from material-ui.
I want to make type restriction of getInputRef lax for solving this problem.
Problem:
error:
Workarround:
The text was updated successfully, but these errors were encountered: