2017-10-08 1 views
1

모든 것을 헛되이 찾으려고 노력했습니다. tsconfig 파일 옵션과 구성 요소 자체에서 수행 할 수있는 모든 가능한 작업을 변경하려고 시도했지만 잘못된 점을 파악할 수는 없습니다. typescript 2.3을 사용하고 있습니다. 도와주세요. 여기 상황이 있습니다.redux-form의 reduxForm 함수 v 7.0이 클래스 구성 요소와 함께 작동하지 않습니다.

export interface AProps{ 
//some data 
}; 

class A extends React.Component<AProps>{ 

    constructor(props){ 
     super(props); 

     } 

    onSubmit(values : any){ 

    } 

    render(){ 
    } 
} 
function validate(values :any){ 
} 

function mapDispatchToProps(dispatch :any){ 

} 

const ReduxForm = reduxForm({ 
validate : validate, 
form : 'ABC' 
})(
A 
) 

내가 simplicity.In의 내부 내용을에 reduxForm 기능을 제거했다 "A"나는이 오류가 무엇입니까 :

[ts] 
Argument of type 'typeof A' is not assignable to parameter of type 'ComponentType<InjectedFormProps<any, {}>>'. 
    Type 'typeof A' is not assignable to type 'StatelessComponent<InjectedFormProps<any, {}>>'. 
    Type 'typeof A' provides no match for the signature '(props: InjectedFormProps<any, {}> & { children?: ReactNode; }, context?: any): ReactElement<any>'. 

답변

0

React.Component 2 종류의 사양을 취 소품에 대한 하나와 하나는 주를위한거야. 구성 요소 상태를 사용하지 않는 경우 (Redux에서 일반적 임) 상태에 대해 빈 객체를 전달할 수 있습니다.

class A extends React.Component<AProps, {}>{ 
... 

당신이 in the online book Hello React and Typescript, on this page.

+0

안녕에 대해, 나는 알고 있지만 여전히 나던 내 문제를 해결 자세한 내용을보실 수 있습니다! –