File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,20 @@ interface Option<T> {
8
8
set : ( value : T ) => void ;
9
9
}
10
10
11
+ export interface ComputedRef < T = any > extends WritableComputedRef < T > {
12
+ readonly value : T ;
13
+ }
14
+
15
+ interface WritableComputedRef < T > extends Ref < T > { }
16
+
11
17
// read-only
12
- export function computed < T > ( getter : Option < T > [ 'get' ] ) : Readonly < Ref < Readonly < T > > > ;
18
+ export function computed < T > ( getter : Option < T > [ 'get' ] ) : ComputedRef < T > ;
13
19
// writable
14
- export function computed < T > ( options : Option < T > ) : Ref < Readonly < T > > ;
20
+ export function computed < T > ( options : Option < T > ) : WritableComputedRef < T > ;
15
21
// implement
16
22
export function computed < T > (
17
23
options : Option < T > [ 'get' ] | Option < T >
18
- ) : Readonly < Ref < Readonly < T > > > | Ref < Readonly < T > > {
24
+ ) : ComputedRef < T > | WritableComputedRef < T > {
19
25
const vm = getCurrentVM ( ) ;
20
26
let get : Option < T > [ 'get' ] , set : Option < T > [ 'set' ] | undefined ;
21
27
if ( typeof options === 'function' ) {
You can’t perform that action at this time.
0 commit comments