fix(type): useResult type inferring 'any' (#872)

This commit is contained in:
Brian Bugh 2019-12-05 08:15:53 -06:00 committed by Guillaume Chau
parent 5ff22e61e9
commit 9edcf2feb8

View File

@ -1,13 +1,15 @@
import { Ref, computed } from '@vue/composition-api'
export function useResult<
TReturnValue = any,
TDefaultValue = any,
TResult = any
> (
result: Ref<TResult>,
defaultValue: any = null,
pick: (data: TResult) => any = null,
defaultValue: TDefaultValue = null,
pick: (data: TResult) => TReturnValue = null,
) {
return computed(() => {
return computed<TDefaultValue | TReturnValue>(() => {
const value = result.value
if (value) {
if (pick) {