我正在用打字稿做反应项目。
这是我在index.ts中的代码
const store = configureStore(initialStateFromDB);
ReactDOM.render(
<Provider store={store}>
<App></App>
</Provider>,
document.getElementById('app')
);
我有很多错误!
第一。
Type 'Provider<AnyAction>' is missing the following properties from type 'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>[]': length, pop, push, concat, and 25 more.ts(2345)
秒
Conversion of type 'Store<{}, AnyAction> & { dispatch: {}; }' to type 'Provider<AnyAction>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.ts(2352)
我不明白这些错误消息的含义。
我该怎么做才能解决此错误?
答案 0 :(得分:0)
OMG
我的文件名为index.ts
我将其更改为index.tsx
现在效果很好。