@@ -16,13 +16,13 @@ import {
16
16
*/
17
17
export type AsyncComputedOnCancel = ( cancelCallback : Fn ) => void
18
18
19
- export interface AsyncComputedOptions {
19
+ export interface AsyncComputedOptions < Lazy = boolean > {
20
20
/**
21
21
* Should value be evaluated lazily
22
22
*
23
23
* @default false
24
24
*/
25
- lazy ?: boolean
25
+ lazy ?: Lazy
26
26
27
27
/**
28
28
* Ref passed to receive the updated of async evaluation
@@ -63,22 +63,22 @@ export interface AsyncComputedOptions {
63
63
export function computedAsync < T > (
64
64
evaluationCallback : ( onCancel : AsyncComputedOnCancel ) => T | Promise < T > ,
65
65
initialState : T ,
66
- optionsOrRef : AsyncComputedOptions & { lazy : true } ,
66
+ optionsOrRef : AsyncComputedOptions < true > ,
67
67
) : ComputedRef < T >
68
68
export function computedAsync < T > (
69
69
evaluationCallback : ( onCancel : AsyncComputedOnCancel ) => T | Promise < T > ,
70
70
initialState : undefined ,
71
- optionsOrRef : AsyncComputedOptions & { lazy : true } ,
71
+ optionsOrRef : AsyncComputedOptions < true > ,
72
72
) : ComputedRef < T | undefined >
73
73
export function computedAsync < T > (
74
74
evaluationCallback : ( onCancel : AsyncComputedOnCancel ) => T | Promise < T > ,
75
75
initialState : T ,
76
- optionsOrRef ?: Ref < boolean > | ( AsyncComputedOptions & { lazy ?: false | undefined } ) ,
76
+ optionsOrRef ?: Ref < boolean > | AsyncComputedOptions ,
77
77
) : Ref < T >
78
78
export function computedAsync < T > (
79
79
evaluationCallback : ( onCancel : AsyncComputedOnCancel ) => T | Promise < T > ,
80
80
initialState ?: undefined ,
81
- optionsOrRef ?: Ref < boolean > | ( AsyncComputedOptions & { lazy ?: false | undefined } ) ,
81
+ optionsOrRef ?: Ref < boolean > | AsyncComputedOptions ,
82
82
) : Ref < T | undefined >
83
83
export function computedAsync < T > (
84
84
evaluationCallback : ( onCancel : AsyncComputedOnCancel ) => T | Promise < T > ,
0 commit comments