Skip to content

Commit 1ddf6cc

Browse files
committed
Fix potential TS 4.7-related syntax issues
1 parent 9167d3c commit 1ddf6cc

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/toolkit/src/devtoolsExtension.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,17 @@ export interface EnhancerOptions {
173173
traceLimit?: number
174174
}
175175

176+
type Compose = typeof compose
177+
178+
interface ComposeWithDevTools {
179+
(options: EnhancerOptions): Compose
180+
<StoreExt>(...funcs: StoreEnhancer<StoreExt>[]): StoreEnhancer<StoreExt>
181+
}
182+
176183
/**
177184
* @public
178185
*/
179-
export const composeWithDevTools: {
180-
(options: EnhancerOptions): typeof compose
181-
<StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>
182-
} =
186+
export const composeWithDevTools: ComposeWithDevTools =
183187
typeof window !== 'undefined' &&
184188
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
185189
? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__

packages/toolkit/src/query/tests/buildHooks.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -963,15 +963,15 @@ describe('hooks tests', () => {
963963
const unwrappedErrorResult =
964964
screen.getByTestId('unwrappedError')?.textContent
965965

966-
errorResult &&
967-
unwrappedErrorResult &&
966+
if (errorResult && unwrappedErrorResult) {
968967
expect(JSON.parse(errorResult)).toMatchObject({
969968
status: 500,
970969
data: null,
971-
}) &&
970+
})
972971
expect(JSON.parse(unwrappedErrorResult)).toMatchObject(
973972
JSON.parse(errorResult)
974973
)
974+
}
975975
})
976976

977977
expect(screen.getByTestId('result').textContent).toBe('')
@@ -1015,14 +1015,14 @@ describe('hooks tests', () => {
10151015
const unwrappedDataResult =
10161016
screen.getByTestId('unwrappedResult')?.textContent
10171017

1018-
dataResult &&
1019-
unwrappedDataResult &&
1018+
if (dataResult && unwrappedDataResult) {
10201019
expect(JSON.parse(dataResult)).toMatchObject({
10211020
name: 'Timmy',
1022-
}) &&
1021+
})
10231022
expect(JSON.parse(unwrappedDataResult)).toMatchObject(
10241023
JSON.parse(dataResult)
10251024
)
1025+
}
10261026
})
10271027

10281028
expect(screen.getByTestId('error').textContent).toBe('')

0 commit comments

Comments
 (0)