Skip to content

Commit 7d7b6ff

Browse files
committed
fix: build fix
1 parent 95c3d09 commit 7d7b6ff

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/use-api/src/useApi.select.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { defineComponent } from 'vue'
1717
import { mount } from '@vue/test-utils'
1818
import type { AxiosInstance, AxiosResponse } from 'axios'
1919
import { useApi } from './useApi'
20+
import type { UseApiOptions } from './types'
2021
import { createApi } from './plugin'
2122
import { clearAllCache } from './features/cacheManager'
2223

@@ -51,13 +52,13 @@ function resolveWith(data: unknown, status = 200) {
5152

5253
function mountSelect<T, TSelected>(
5354
selectFn: (data: T) => TSelected,
54-
extra: Parameters<typeof useApi>[1] = {},
55+
extra: Omit<NonNullable<Parameters<typeof useApi>[1]>, 'select'> = {},
5556
) {
5657
let api!: ReturnType<typeof useApi<T, unknown, TSelected>>
5758
mount(
5859
defineComponent({
5960
setup() {
60-
api = useApi<T, unknown, TSelected>('/test', { select: selectFn, ...extra })
61+
api = useApi<T, unknown, TSelected>('/test', { select: selectFn, ...extra } as UseApiOptions<T, unknown, TSelected>)
6162
return () => null
6263
},
6364
}),

packages/use-api/src/useApiBatch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ref, computed, effectScope, getCurrentScope, onScopeDispose, toValue, watch, type Ref, type MaybeRefOrGetter } from "vue";
2+
import type { AxiosResponse } from "axios";
23
import { useApi } from "./useApi";
34
import type {
45
UseApiBatchOptions,
@@ -160,7 +161,7 @@ export function useApiBatch<T = unknown>(
160161
data: result ?? null,
161162
error: reqError.value,
162163
statusCode: statusCode.value,
163-
response: response.value,
164+
response: response.value as AxiosResponse<T> | null,
164165
request: config,
165166
};
166167

0 commit comments

Comments
 (0)