0
When configuring Redux Devtools I get the following Typescript error:
Property 'REDUX_DEVTOOLS_EXTENSION_COMPOSE' does not exist on type 'Window & typeof globalThis'.
store ts.
import { applyMiddleware, createStore, Store } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { DevsState } from './ducks/devs/types';
import rootReducer from './ducks/rootReducer';
import rootSaga from './ducks/rootSaga';
export interface ApplicationState {
devs: DevsState
}
const composeEnhancers =
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
}) : compose;
const sagaMiddleware = createSagaMiddleware();
const enhancer = composeEnhancers(
applyMiddleware(sagaMiddleware),
);
const store: Store<ApplicationState> = createStore(rootReducer, enhancer);
sagaMiddleware.run(rootSaga);
export default store;
Instead of
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
trywindow['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__']
. Suspect of a situation (which occurs in the pre-parse of ts)– Guilherme Nascimento