要设置 React Native 调试器,我们必须像这样声明一个作曲家:
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(
rootReducers,
composeEnhancers(applyMiddleware(thunk))
)
但是当使用 typescript TS Compiler 时说:Cannot find name 'window'.ts(2304)
已经尝试将密钥更改lib
为此tsconfig.json
:
"lib": ["es6", "DOM"]
但是错误变为:
Property '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' does not exist on type 'Window & typeof globalThis'.ts(2339)