首页 > 解决方案 > Reactjs,Typescript 错误 TS2322:类型 {} 不可分配给类型“IntrinsicAttributes & IntrinsicClassAttributes”

问题描述

嗨,伙计们,我遇到了某种打字稿错误的问题,你能找个时间给我买个答案吗?错误行标有 //->>// (..................... ..................................................... ..................................................... ..................................................... . ) -->来自詹金斯的图片<--

这是我的代码

render() {
        return (
            <CS.ModalWrapper onClick={e => e.stopPropagation()}>
                <S.Legend>Add notification</S.Legend>
                <S.InputSection>
                    <S.Header>Type</S.Header>
                    <S.SelectWrapper>
                        <Select
           //This line ->// options={notificationTypes.map(value => ({ value, label: value }))}
                            onChange={element => element && this.handleChange(element, 'notification')}
                        />
                    </S.SelectWrapper>
                </S.InputSection>
                <S.InputSection>
                    <S.Header>Days</S.Header>
                    <S.SelectWrapper>
                        <Select
           //This line ->// isMulti
                            options={daysOfWeek.map((value, index) => ({
                                value: `${index}`,
                                label: value,
                            }))}
                            onChange={options => options && this.handleChange(options, 'selectedDays')}
                        />
                    </S.SelectWrapper>
                </S.InputSection>
                <S.InputSection>
                    <S.Header>Hours</S.Header>
                    <S.SelectWrapper>
                        <Select
           //This line ->// isMulti
                            options={getRange(24).map(val => ({
                                value: `${val}`,
                                label: formatNumberToHours(val),
                            }))}
                            onChange={options => options && this.handleChange(options, 'selectedHours')}
                        />
                    </S.SelectWrapper>
                </S.InputSection>
                <CS.ButtonsWrapper>
                    <CS.Button onClick={this.props.closeForm}>Cancel</CS.Button>
                    <CS.Button onClick={this.handleSubmit}>Submit</CS.Button>
                </CS.ButtonsWrapper>
                <S.ErrorMessage>{this.state.error}</S.ErrorMessage>
            </CS.ModalWrapper>
        );
    }
}

标签: javascriptreactjstypescriptjenkinserror-handling

解决方案


推荐阅读