Skip to content

Commit a4464a8

Browse files
authored
Merge pull request #61 from InhiblabCore/dev
fix: use-request data & error type
2 parents 96f73a3 + a4863f4 commit a4464a8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/hooks/src/useRequest/__tests__/plugin.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('useRequest/Plugin', () => {
5555

5656
it('useRequest custom plugin should work', async () => {
5757
await sleep(1000)
58-
expect(data?.value.name).toBe('vue-hooks-plus - plugins update')
59-
expect(data?.value.age).toBe(20)
58+
expect(data.value?.name).toBe('vue-hooks-plus - plugins update')
59+
expect(data.value?.age).toBe(20)
6060
})
6161
})

packages/hooks/src/useRequest/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export type Plugin<TData, TParams extends any[], TPlugin = any> = {
105105

106106
export interface Result<TData, TParams extends any[]> {
107107
loading: Ref<boolean>
108-
data?: Ref<TData>
109-
error?: Ref<Error>
108+
data: Ref<TData | undefined>
109+
error: Ref<Error | undefined>
110110
params: Ref<TParams | []>
111111
cancel: Fetch<TData, TParams>['cancel']
112112
refresh: Fetch<TData, TParams>['refresh']

0 commit comments

Comments
 (0)