1

I'm trying to build my app (using Redux and electron) with : yarn build

I get this error on Windows :

Property 'REDUX_DEVTOOLS_EXTENSION_COMPOSE' does not exist on type 'Window & typeof globalThis'

the error is in this block of code that I use for the configuration of Redux :

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
export const store = createStore( persistedReducer,
 composeEnhancers(applyMiddleware(thunkMiddleware))
);

how can I correct it ?

Xodarap
  • 343
  • 1
  • 6
  • 23
  • Could this be an answer https://stackoverflow.com/questions/12709074/how-do-you-explicitly-set-a-new-property-on-window-in-typescript – Serhii Yukhnevych Aug 05 '20 at 13:26
  • thanks for your reply but I don't see anything helpful there ... can you be more precise ? please. – Xodarap Aug 05 '20 at 13:35
  • As you are using TS when you are trying to access a property on `window` that doesn't exist in `Window` type declaration. The compiler will error. There are several things you can do, you can try to use `@ts-ignore` so the compiler doesn't error or you can make extend window declaration with new property – Serhii Yukhnevych Aug 05 '20 at 13:39
  • Also you can try to do it like that: `window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__` – Serhii Yukhnevych Aug 05 '20 at 13:40
  • it was a good solution, thanks. but because I'm using a tsx format the exact solution was (window as any) and not window – Xodarap Aug 05 '20 at 14:05
  • @SerhiiYukhnevych can you please post your solution as an answer and not like a comment ? like that I can close this post as finish. – Xodarap Aug 10 '20 at 09:52

1 Answers1

0

As you are using TS when you are trying to access a property on window that doesn't exist in Window type declaration. The compiler will error. There are several things you can do, you can try to use @ts-ignore so the compiler doesn't error or you can make extend window declaration with new property. Also you can try to do it like that: <any>window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ or window as any if you are using .tsx