Luna
Luna

Reputation: 597

Usage of React Native Debugger with typescript

To setup React Native debugger we have to declare a composer like this:

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

const store = createStore(
  rootReducers,
  composeEnhancers(applyMiddleware(thunk))
)

But when using with typescript TS Compiler says: Cannot find name 'window'.ts(2304)

Already tried changing the key lib in tsconfig.json to this:

"lib": ["es6", "DOM"]

But the error changes to:

Property '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' does not exist on type 'Window & typeof globalThis'.ts(2339)

Upvotes: 2

Views: 368

Answers (1)

AmerllicA
AmerllicA

Reputation: 32572

Actually, React Native Debugger doesn't need to setup. Just use Redux and React Native Debugger will catch your state.

Using __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ need to write window. __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ and the window object is just for browswer.

Upvotes: 1

Related Questions