[英]Property 'xxxx' does not exist on type '{}'
I am debugging a code I have not written, and I am new to typescript.我正在调试一个我没有写的代码,我是 typescript 的新手。 I am getting a TS2339 error
我收到 TS2339 错误
Property 'InputFiles' does not exist on type '{}'.
类型“{}”上不存在属性“InputFiles”。
I understand that this means that I am missing to hand-over the property, but what should I modify?我明白这意味着我错过了移交财产,但我应该修改什么?
Within UI\src\containers\FileUploaderContainer.tsx
, I have something like在
UI\src\containers\FileUploaderContainer.tsx
内,我有类似的东西
export class FileUploader extends React.Component<any, any> {
render() {
return ( <div><UploadFileFormContainer /></div> );
}
}
const FileUploaderContainer: { any } = connect(
state => ({ InputFiles: state.InputFiles }), // error occurs here
dispatch => ({})
)(FileUploader);
export default FileUploaderContainer;
If I hover in Visual Studio above connect
, I see如果我在上面的 Visual Studio 中
connect
hover ,我看到
(alias) connect<{InputFiles: any;}, any, {}, {}>(mapStateToProps: MapStateToPropsParam<{
InputFIles: any; }, {}, {}>, mapDispatchToProps: MapDispatchToPropsNonObject<any,{}>):
InterferableComponentEnhancerWithPropos<any,{}> (+ 14 overloads)
import connect
The following issues did not help me to resolve my issue以下问题没有帮助我解决我的问题
You may just add any
type for the state like this:您可以像这样为 state 添加
any
类型:
const FileUploaderContainer : any = connect(
(state : any ) => ({ InputFiles: state.InputFiles }), // just add any type on state
dispatch => ({})
)(FileUploader);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.