typescript - CRA - Dinamik redux-thunk'un AppState türü "unknown" olarak başarısız oluyor
Bir NextJS projesini Create-React-App'e taşıyorum. İkincisinde, AppState'in dinamik türü "unknown" olarak atıyor.
Her iki projenin de aynı sürümlere sahip olduğunu unutmayın:
- Typescript:
3.5.3 - React:
16.9.0 - Redux, Redux-Thunk, React-Redux
İşte mağazayı ve türleri nasıl oluşturduğum:
export function makeStore(initialState: any) {
const store = createStore(
combinedReducers,
initialState,
composeEnhancers(
applyMiddleware(thunk as ThunkMiddleware<ReturnType<typeof combinedReducers>, AnyAction>)
)
);
return store;
}
// This type is needed so Store.dispatch is from redux-thunk
export type AppStore = ReturnType<typeof makeStore>;
export type AppState = ReturnType<AppStore['getState']>;
Şimdi, bir bileşene bazı veriler aktarırken, yalnızca CRA uygulamasında bu hataları alıyorum:
Hata:
Benim anladığım kadarıyla, IDE (VSCode) tipi doğru alıyor, ancak Typescript bunun bilinmeyen olduğunu söylüyor ve derlemeyi başaramıyor. Bununla ne yapacağımı bilmiyorum. Bu sorunu düzeltmek için nerelere bakmalıyım?

