Skip to content

Commit c609eb7

Browse files
committed
Reformat typetests to handle mismatched TS 4.x/5.x error locations
1 parent 9501bc4 commit c609eb7

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

test/typescript/store.ts

+22-30
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ const storeWithPreloadedState: Store<State> = createStore(reducer, {
6969
b: { c: 'c', d: 'd' },
7070
e: brandedString
7171
})
72-
// @ts-expect-error
73-
const storeWithBadPreloadedState: Store<State> = createStore(reducer, {
74-
b: { c: 'c' },
75-
e: brandedString
76-
})
72+
73+
const storeWithBadPreloadedState: Store<State> =
74+
// @ts-expect-error
75+
// prettier-ignore
76+
createStore(reducer, { b: { c: 'c' }, e: brandedString })
7777

7878
const reducerA: Reducer<string> = (state = 'a') => state
7979
const reducerB: Reducer<{ c: string; d: string }> = (
@@ -91,14 +91,11 @@ const storeWithCombineReducer = createStore(combinedReducer, {
9191
b: { c: 'c', d: 'd' },
9292
e: brandedString
9393
})
94-
// @ts-expect-error
95-
const storeWithCombineReducerAndBadPreloadedState = createStore(
96-
combinedReducer,
97-
{
98-
b: { c: 'c' },
99-
e: brandedString
100-
}
101-
)
94+
95+
const storeWithCombineReducerAndBadPreloadedState =
96+
// @ts-expect-error
97+
// prettier-ignore
98+
createStore( combinedReducer, { b: { c: 'c' }, e: brandedString } )
10299

103100
const nestedCombinedReducer = combineReducers({
104101
a: (state: string = 'a') => state,
@@ -120,10 +117,10 @@ const simpleCombinedReducer = combineReducers({
120117
d: (state: string = 'd') => state
121118
})
122119

123-
// @ts-expect-error
124-
const storeWithSimpleCombinedReducer = createStore(simpleCombinedReducer, {
125-
c: 5
126-
})
120+
const storeWithSimpleCombinedReducer =
121+
// @ts-expect-error
122+
// prettier-ignore
123+
createStore(simpleCombinedReducer, { c: 5 })
127124

128125
// Note: It's not necessary that the errors occur on the lines specified, just as long as something errors somewhere
129126
// since the preloaded state doesn't match the reducer type.
@@ -133,11 +130,10 @@ const simpleCombinedReducerWithImplicitState = combineReducers({
133130
d: (state = 'd') => state
134131
})
135132

136-
// @ts-expect-error
137-
const storeWithSimpleCombinedReducerWithImplicitState = createStore(
138-
simpleCombinedReducerWithImplicitState,
139-
{ c: 5 }
140-
)
133+
const storeWithSimpleCombinedReducerWithImplicitState =
134+
// @ts-expect-error
135+
// prettier-ignore
136+
createStore( simpleCombinedReducerWithImplicitState, { c: 5 } )
141137

142138
const storeWithActionReducer = createStore(reducerWithAction)
143139
const storeWithActionReducerAndPreloadedState = createStore(reducerWithAction, {
@@ -148,14 +144,10 @@ const storeWithActionReducerAndPreloadedState = createStore(reducerWithAction, {
148144
funcWithStore(storeWithActionReducer)
149145
funcWithStore(storeWithActionReducerAndPreloadedState)
150146

151-
// @ts-expect-error
152-
const storeWithActionReducerAndBadPreloadedState = createStore(
153-
reducerWithAction,
154-
{
155-
b: { c: 'c' },
156-
e: brandedString
157-
}
158-
)
147+
const storeWithActionReducerAndBadPreloadedState =
148+
// @ts-expect-error
149+
// prettier-ignore
150+
createStore( reducerWithAction, { b: { c: 'c' }, e: brandedString } )
159151

160152
const enhancer: StoreEnhancer = next => next
161153

0 commit comments

Comments
 (0)