Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Getting error: 'component' does not exist in type 'FormControlProps'

$
0
0

I am able to set { component: "fieldset", ...param } to FormControlProps:

const Temp = () => {  const param: FormControlProps = {};  // Able to set `{ component: "fieldset", ...param }` to `FormControlProps`:<FormControl {...{ component: "fieldset", ...param }} />;};

But not able to do same thing through the CustomFormControl:

interface ICustomFormControlProps {  customFormControlProps: FormControlProps; // lets keep them same for some reason}const CustomFormControl = (param: ICustomFormControlProps) => {  return <FormControl {...param.customFormControlProps} />; // so, basically CustomFormControl is same as FormControl};const Temp2 = (param2: ICustomFormControlProps) => {  return (<CustomFormControl      pacustomFormControlPropsram={{        component: "fieldset", // Error occurs here        ...param2.customFormControlProps      }}    />  );};

It gives me following error:

Object literal may only specify known properties, and 'component' does not exist in type 'FormControlProps<"div", {}>'

Why is this so?

here is the codesandbox


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>