File tree 3 files changed +7
-5
lines changed
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 8
8
customRef ,
9
9
triggerRef ,
10
10
Ref ,
11
- UnwrapRef
11
+ UnwrapRef ,
12
+ ToRefs
12
13
} from './ref'
13
14
export {
14
15
reactive ,
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ export interface Ref<T = any> {
20
20
value : T
21
21
}
22
22
23
+ export type ToRefs < T = any > = { [ K in keyof T ] : Ref < T [ K ] > }
24
+
23
25
const convert = < T extends unknown > ( val : T ) : T =>
24
26
isObject ( val ) ? reactive ( val ) : val
25
27
@@ -108,9 +110,7 @@ export function customRef<T>(factory: CustomRefFactory<T>): Ref<T> {
108
110
return r as any
109
111
}
110
112
111
- export function toRefs < T extends object > (
112
- object : T
113
- ) : { [ K in keyof T ] : Ref < T [ K ] > } {
113
+ export function toRefs < T extends object > ( object : T ) : ToRefs < T > {
114
114
if ( __DEV__ && ! isProxy ( object ) ) {
115
115
console . warn ( `toRefs() expects a reactive object but received a plain one.` )
116
116
}
Original file line number Diff line number Diff line change @@ -153,7 +153,8 @@ export {
153
153
Ref ,
154
154
ComputedRef ,
155
155
UnwrapRef ,
156
- WritableComputedOptions
156
+ WritableComputedOptions ,
157
+ ToRefs
157
158
} from '@vue/reactivity'
158
159
export {
159
160
// types
You can’t perform that action at this time.
0 commit comments