Skip to content

Commit

Permalink
Merge pull request #4136 from reduxjs/fix-retry
Browse files Browse the repository at this point in the history
Fix RetryOptions type test by flipping order
  • Loading branch information
EskiMojo14 committed Jan 29, 2024
2 parents 8bb90a1 + efb1ebd commit 527e0b6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/toolkit/src/query/tests/retry.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import type { RetryOptions } from '@internal/query/retry'

describe('type tests', () => {
test('RetryOptions only accepts one of maxRetries or retryCondition', () => {
// Should not complain if only `maxRetries` exists
expectTypeOf({ maxRetries: 5 }).toMatchTypeOf<RetryOptions>()

// Should not complain if only `retryCondition` exists
expectTypeOf({ retryCondition: () => false }).toMatchTypeOf<RetryOptions>()

// Should complain if both `maxRetries` and `retryCondition` exist at once
expectTypeOf<RetryOptions>().not.toMatchTypeOf({
expectTypeOf({
maxRetries: 5,
retryCondition: () => false,
})
}).not.toMatchTypeOf<RetryOptions>()
})
})

Expand Down

0 comments on commit 527e0b6

Please sign in to comment.