Skip to content

Commit 4718f2c

Browse files
committed
pref: kill ugly writing
1 parent 64a6e3a commit 4718f2c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

test/integration/dynamic-reducers.spec.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ describe('React', () => {
4343
children: ReactNode
4444
reducers: ReducersType
4545
}
46-
46+
interface ReduxContextType extends ReactReduxContextValue {
47+
storeState?: any
48+
}
4749
function ExtraReducersProvider({
4850
children,
4951
reducers,
@@ -53,13 +55,9 @@ describe('React', () => {
5355
{(injectReducers) => (
5456
<ReactReduxContext.Consumer>
5557
{(reduxContext) => {
56-
interface ReduxContextType extends ReactReduxContextValue {
57-
storeState?: any
58-
}
59-
const latestState =
60-
reduxContext && reduxContext.store.getState()
61-
const contextState =
62-
reduxContext && (reduxContext as ReduxContextType).storeState
58+
const latestState = reduxContext!.store.getState()
59+
const contextState = (reduxContext as ReduxContextType)
60+
.storeState
6361

6462
let shouldInject = false
6563
let shouldPatch = false
@@ -80,7 +78,7 @@ describe('React', () => {
8078
}
8179

8280
if (shouldInject) {
83-
injectReducers && injectReducers(reducers)
81+
injectReducers!(reducers)
8482
}
8583

8684
if (shouldPatch && reduxContext) {
@@ -89,7 +87,7 @@ describe('React', () => {
8987
// this would better avoid tearing in a future concurrent world
9088
const patchedReduxContext = {
9189
...reduxContext,
92-
storeState: reduxContext && reduxContext.store.getState(),
90+
storeState: reduxContext!.store.getState(),
9391
}
9492
return (
9593
<ReactReduxContext.Provider value={patchedReduxContext}>

0 commit comments

Comments
 (0)