mirror of https://github.com/vuejs/core.git
Merge dafd7dddd8
into ba391f5fdf
This commit is contained in:
commit
5dfc327399
|
@ -45,6 +45,8 @@ export function isRef(r: any): r is Ref {
|
|||
return r ? r[ReactiveFlags.IS_REF] === true : false
|
||||
}
|
||||
|
||||
export type TypeRef<T> = Ref<UnwrapRef<T>, UnwrapRef<T> | T>
|
||||
|
||||
/**
|
||||
* Takes an inner value and returns a reactive and mutable ref object, which
|
||||
* has a single property `.value` that points to the inner value.
|
||||
|
@ -54,7 +56,7 @@ export function isRef(r: any): r is Ref {
|
|||
*/
|
||||
export function ref<T>(
|
||||
value: T,
|
||||
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>
|
||||
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : TypeRef<T>
|
||||
export function ref<T = any>(): Ref<T | undefined>
|
||||
export function ref(value?: unknown) {
|
||||
return createRef(value, false)
|
||||
|
|
Loading…
Reference in New Issue