私は、create-react-app --scripts-version = react-scripts-tsコマンドを使用してtypescriptサポートを持つ反応アプリケーションを作成しようとしています。typescript内のコンストラクタ()内でsuper()を呼び出せません
私はこのエラーを見続ける:
は(23,15): error TS2345: Argument of type 'Props | undefined' is not assignable to parameter of type 'Props'. Type 'undefined' is not assignable to type 'Props'.
これはから来ているコードは、このです:
これを引き起こしているのかわからexport class ScratchpadComponent extends React.Component<ScratchpadComponent.Props, ScratchpadComponent.State> {
constructor(props?: ScratchpadComponent.Props, context?: any) {
super(props, context);
this.submit = this.submit.bind(this);
}
ない - 私は周りに検索しませんしましたこれを解決する方法には多くの手がかりがありますか?
更新:
オプションの?
18,11): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<Props, "dispatch" | "scratchPadActi...'.
Type '{}' is not assignable to type 'Readonly<Pick<Props, "dispatch" | "scratchPadActions" | "scratchData" | "errorMessage" | "errorDa...'.
Property 'dispatch' is missing in type '{}'.
ちょっと私はコンポーネント定義からオプションの署名を削除して、今見ているエラーで質問を更新しました。あなたはこのエラーを取り除く方法を知っていますか? –