Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types of property 'component' are incompatible #260

Open
cuyu opened this issue Jun 27, 2018 · 1 comment
Open

Types of property 'component' are incompatible #260

cuyu opened this issue Jun 27, 2018 · 1 comment

Comments

@cuyu
Copy link

cuyu commented Jun 27, 2018

Hi, I just use this lib with redux-form and get these errors when compiling with typescript:

(13,33): Types of property 'component' are incompatible.
  Type 'typeof Checkbox' is not assignable to type '"input" | "select" | "textarea" | ComponentClass<WrappedFieldProps & CheckboxProps> | StatelessCo...'.
    Type 'typeof Checkbox' is not assignable to type 'StatelessComponent<WrappedFieldProps & CheckboxProps>'.
      Type 'typeof Checkbox' provides no match for the signature '(props: WrappedFieldProps & CheckboxProps & { children?: ReactNode; }, context?: any): ReactElement<any> | null'.

The codes are:

import * as React from 'react';
import {Field, reduxForm} from 'redux-form';
import {
    Checkbox,
} from 'redux-form-material-ui'
import FormLabel from "@material-ui/core/FormLabel/FormLabel";


let MonitorCrashForm = (props: any) => {
    return (
        <form className='left-form'>
            <FormLabel component="legend">How to receive the crash alert:</FormLabel>
            <Field name="email" component={Checkbox} label="Email?"/>
            <Field name="slack" component={Checkbox} label="Slack?"/>
        </form>
    )
};

export default reduxForm({
    // a unique name for the form
    form: 'monitorCrash'
})(MonitorCrashForm)

The versions are:

"redux-form": "^7.4.2",
"redux-form-material-ui": "^4.3.4",
"typescript": "^2.9.2"

Looks like the declaration is wrong?

@davakh
Copy link

davakh commented Dec 18, 2018

fast fix for me was component={Checkbox as "div"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants