I'm new with TypeScript, I have converted all my code (React Hooks) into TypeScript except for this one thing where I get the following error:
No overload matches this call.
Overload 1 of 2, '(props: { component: ElementType; } & { children?: ReactNode; color?: "primary" | "secondary" | undefined; disabled?: boolean | undefined; error?: boolean | undefined; ... 6 more ...; variant?: "outlined" | ... 2 more ... | undefined; } & CommonProps & Pick): Element', gave the following error.
Property 'component' is missing in type '{ children: Element; className: string; htmlFor: string; }' but required in type '{ component: ElementType; }'.
Overload 2 of 2, '(props: DefaultComponentProps>): Element', gave the following error.
Type '{ children: Element; className: string; htmlFor: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; color?
The issue is coming from here:
import {
Box,
Button,
TextField,
FormControl,
FormGroup,
Select,
} from "@material-ui/core/";
import { Trans } from "react-i18next";
interface ConnectedLinkProps {
onSubmit: string;
classes: {
formControl: string;
};
}
<FormControl className={classes.formControl} htmlFor="source">
<TextField
id="source"
disabled={true}
value={linkSettings.source}
label={<Trans i18nKey="form.linkForm.sourceNode">Source Node</Trans>}
/>
</FormControl>;
The whole first line which is 'FormControl line' is red.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…