Skip to content

Commit

Permalink
update type test
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Oct 17, 2021
1 parent 1952ef8 commit 56ec553
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/toolkit/src/tests/createAsyncThunk.typetest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,15 @@ const anyAction = { type: 'foo' } as AnyAction
// @ts-expect-error
const shouldFailNumWithoutArgs = createAsyncThunk('foo', () => {}, { idGenerator: returnsNumWithoutArgs })

const returnsStrWithArgs = (foo: any) => 'foo'
const returnsStrWithNumberArg = (foo: number) => 'foo'
// prettier-ignore
// @ts-expect-error
const shouldFailStrArgs = createAsyncThunk('foo', () => {}, { idGenerator: returnsStrWithArgs })
const shouldFailWrongArgs = createAsyncThunk('foo', (arg: string) => {}, { idGenerator: returnsStrWithNumberArg })

const returnsStrWithStringArg = (foo: string) => 'foo'
const shoulducceedCorrectArgs = createAsyncThunk('foo', (arg: string) => {}, {
idGenerator: returnsStrWithStringArg,
})

const returnsStrWithoutArgs = () => 'foo'
const shouldSucceed = createAsyncThunk('foo', () => {}, {
Expand Down

0 comments on commit 56ec553

Please sign in to comment.