Skip to content

pref: kill ugly writing #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions test/integration/dynamic-reducers.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ describe('React', () => {
children: ReactNode
reducers: ReducersType
}

interface ReduxContextType extends ReactReduxContextValue {
storeState?: any
}
function ExtraReducersProvider({
children,
reducers,
Expand All @@ -53,13 +55,9 @@ describe('React', () => {
{(injectReducers) => (
<ReactReduxContext.Consumer>
{(reduxContext) => {
interface ReduxContextType extends ReactReduxContextValue {
storeState?: any
}
const latestState =
reduxContext && reduxContext.store.getState()
const contextState =
reduxContext && (reduxContext as ReduxContextType).storeState
const latestState = reduxContext!.store.getState()
const contextState = (reduxContext as ReduxContextType)
.storeState

let shouldInject = false
let shouldPatch = false
Expand All @@ -80,7 +78,7 @@ describe('React', () => {
}

if (shouldInject) {
injectReducers && injectReducers(reducers)
injectReducers!(reducers)
}

if (shouldPatch && reduxContext) {
Expand All @@ -89,7 +87,7 @@ describe('React', () => {
// this would better avoid tearing in a future concurrent world
const patchedReduxContext = {
...reduxContext,
storeState: reduxContext && reduxContext.store.getState(),
storeState: reduxContext!.store.getState(),
}
return (
<ReactReduxContext.Provider value={patchedReduxContext}>
Expand Down