Skip to content

Commit 9edcf2f

Browse files
bbughAkryum
authored andcommitted
fix(type): useResult type inferring 'any' (#872)
1 parent 5ff22e6 commit 9edcf2f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/vue-apollo-composable/src/useResult.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Ref, computed } from '@vue/composition-api'
22

33
export function useResult<
4+
TReturnValue = any,
5+
TDefaultValue = any,
46
TResult = any
57
> (
68
result: Ref<TResult>,
7-
defaultValue: any = null,
8-
pick: (data: TResult) => any = null,
9+
defaultValue: TDefaultValue = null,
10+
pick: (data: TResult) => TReturnValue = null,
911
) {
10-
return computed(() => {
12+
return computed<TDefaultValue | TReturnValue>(() => {
1113
const value = result.value
1214
if (value) {
1315
if (pick) {

0 commit comments

Comments
 (0)