File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -452,3 +452,7 @@ describe('toRef <-> toValue', () => {
452
452
) ,
453
453
)
454
454
} )
455
+
456
+ // unref
457
+ declare const text : ShallowRef < string > | ComputedRef < string > | MaybeRef < string >
458
+ expectType < string > ( unref ( text ) )
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T)
235
235
* @param ref - Ref or plain value to be converted into the plain value.
236
236
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref }
237
237
*/
238
- export function unref < T > ( ref : MaybeRef < T > | ComputedRef < T > ) : T {
238
+ export function unref < T > ( ref : MaybeRef < T > | ComputedRef < T > | ShallowRef < T > ) : T {
239
239
return isRef ( ref ) ? ref . value : ref
240
240
}
241
241
@@ -255,7 +255,9 @@ export function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T {
255
255
* @param source - A getter, an existing ref, or a non-function value.
256
256
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue }
257
257
*/
258
- export function toValue < T > ( source : MaybeRefOrGetter < T > | ComputedRef < T > ) : T {
258
+ export function toValue < T > (
259
+ source : MaybeRefOrGetter < T > | ComputedRef < T > | ShallowRef < T > ,
260
+ ) : T {
259
261
return isFunction ( source ) ? source ( ) : unref ( source )
260
262
}
261
263
You can’t perform that action at this time.
0 commit comments