File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -452,3 +452,7 @@ describe('toRef <-> toValue', () => {
452452 ) ,
453453 )
454454} )
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)
235235 * @param ref - Ref or plain value to be converted into the plain value.
236236 * @see {@link https://vuejs.org/api/reactivity-utilities.html#unref }
237237 */
238- export function unref < T > ( ref : MaybeRef < T > | ComputedRef < T > ) : T {
238+ export function unref < T > ( ref : MaybeRef < T > | ComputedRef < T > | ShallowRef < T > ) : T {
239239 return isRef ( ref ) ? ref . value : ref
240240}
241241
@@ -255,7 +255,9 @@ export function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T {
255255 * @param source - A getter, an existing ref, or a non-function value.
256256 * @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue }
257257 */
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 {
259261 return isFunction ( source ) ? source ( ) : unref ( source )
260262}
261263
You can’t perform that action at this time.
0 commit comments