私はReactとTypeScriptの両方に新しいので、私が見逃したことがあるかもしれません。私は、次の操作を実行しようとしている:React TypeScriptプロパティ 'assign'が 'Object constructor'型に存在しません
const props = Object.assign({}, this.props, {
loaded: this.state.loaded
});
私は私の.tsx
ファイルで、このエラーを取得:this threadと試してみましたが見つかりProperty 'assign' does not exist on type 'Object constructor'.
:Property 'any' does not exist on type 'JXS.IntrinsicElements'.
const props = (<any>Object).assign({}, this.props, {
loaded: this.state.loaded
});
が私にこのエラーを与えました
私もこれを試しましたが、宣言のためにUnexpected modifier
を返しました。
declare interface ObjectConstructor {
assign(target: any, ...sources: any[]): any;
}
何が欠けていますか?
これはちょっと奇妙です。あなたはもう少し文脈を与えることができますか?例えば。あなたが使っているコンポーネントと、おそらくあなたの 'tsconfig'ですか?最初のコードスニペットに問題はないはずですから。 –