Skip to content
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
22 changes: 6 additions & 16 deletions playground/tests/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('$[client]', async () => {

it('has correct return type', () => async () => {
const data = await $pets('/pet/{petId}')
expectTypeOf(data).toMatchTypeOf<ReturnData>()
expectTypeOf(data).toExtend<ReturnData>()
})

it('returns correct type based on accept header', () => async () => {
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('use[Client]', async () => {
immediate: false,
})

expectTypeOf(data).toMatchTypeOf<Ref<ReturnData | undefined>>()
expectTypeOf(data).toExtend<Ref<ReturnData | undefined>>()
})

it('has correct "transform" input parameter type', () => () => {
Expand All @@ -162,9 +162,7 @@ describe('use[Client]', async () => {
immediate: false,
})

expectTypeOf(data).toMatchTypeOf<Ref<{
foo: string
} | undefined>>()
expectTypeOf(data).toExtend<Ref<{ foo: string } | undefined>>()
})

it('has correct reponse type using "default"', () => () => {
Expand All @@ -176,9 +174,7 @@ describe('use[Client]', async () => {
immediate: false,
})

expectTypeOf(data).toMatchTypeOf<Ref<ReturnData | {
bar: number
}>>()
expectTypeOf(data).toExtend<Ref<ReturnData | { bar: number }>>()
})

it('has correct response type using "default" and "transform"', () => () => {
Expand All @@ -193,11 +189,7 @@ describe('use[Client]', async () => {
immediate: false,
})

expectTypeOf(data).toMatchTypeOf<Ref<{
foo: string
} | {
bar: number
}>>()
expectTypeOf(data).toExtend<Ref<{ foo: string } | { bar: number }>>()
})

it('has correct response type using "pick"', () => () => {
Expand All @@ -207,9 +199,7 @@ describe('use[Client]', async () => {
immediate: false,
})

expectTypeOf(data).toMatchTypeOf<Ref<{
name: string
} | undefined>>()
expectTypeOf(data).toExtend<Ref<{ name: string } | undefined>>()
})

it('returns correct type based on accept header', () => () => {
Expand Down