JSX element type does not have any construct or call signatures. Typescript

后端 未结 3 722
情话喂你
情话喂你 2021-01-18 06:10

In case compose is used there is an error JSX element type ‘Option’ does not have any construct or call signatures. \'redux\' version - 3.7.2

3条回答
  •  甜味超标
    2021-01-18 06:38

    The problem is probably that you are wrapping your arguments to compose in an array, and then destructuring the array using the spread operator (...).

    There is no reason to do this since it is semantically equivalent to passing the arguments directly. This construction may also prevent TypeScript from inferring the type parameters for compose correctly.

    You could rewrite your compose call as

    const Option = compose(
        connect(null,
            dispatch => ({
                onClick: (name) => dispatch(setActive(name)),
            })),
        fela({
            option: ({ theme }) => ({
                ...getControlOptionColors(theme),
            }),
        }),
    )(withTheme(({ label, name, onClick, styles }) => (
        
    {label}
    )));

    That might solve the problem, but I can’t be sure as the snippet of code you’ve provided is not sufficiently complete for me to test it.

提交回复
热议问题