File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ export function isRef(r: any): r is Ref {
28
28
return r ? r . _isRef === true : false
29
29
}
30
30
31
- export function ref < T > ( value : T ) : T extends Ref ? T : Ref < UnwrapRef < T > >
31
+ export function ref < T extends object > (
32
+ value : T
33
+ ) : T extends Ref ? T : Ref < UnwrapRef < T > >
34
+ export function ref < T > ( value : T ) : Ref < UnwrapRef < T > >
32
35
export function ref < T = any > ( ) : Ref < T | undefined >
33
36
export function ref ( value ?: unknown ) {
34
37
return createRef ( value )
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ function plainType(arg: number | Ref<number>) {
21
21
expectType < Ref < { foo : number } > > ( nestedRef )
22
22
expectType < { foo : number } > ( nestedRef . value )
23
23
24
+ // ref boolean
25
+ const falseRef = ref ( false )
26
+ expectType < Ref < boolean > > ( falseRef )
27
+ expectType < boolean > ( falseRef . value )
28
+
29
+ // ref true
30
+ const trueRef = ref < true > ( true )
31
+ expectType < Ref < true > > ( trueRef )
32
+ expectType < true > ( trueRef . value )
33
+
24
34
// tuple
25
35
expectType < [ number , string ] > ( unref ( ref ( [ 1 , '1' ] ) ) )
26
36
You can’t perform that action at this time.
0 commit comments