We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
shallowRef
1 parent 305e4ae commit 42942e9Copy full SHA for 42942e9
src/v3/reactivity/ref.ts
@@ -51,9 +51,13 @@ declare const ShallowRefMarker: unique symbol
51
52
export type ShallowRef<T = any> = Ref<T> & { [ShallowRefMarker]?: true }
53
54
-export function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T>
55
-export function shallowRef<T extends Ref>(value: T): T
56
-export function shallowRef<T>(value: T): ShallowRef<T>
+export function shallowRef<T>(
+ value: T
+): 1 extends (T extends Ref ? 1 : 0)
57
+ ? T extends Ref
58
+ ? IfAny<T, ShallowRef<T>, T>
59
+ : ShallowRef<T>
60
61
export function shallowRef<T = any>(): ShallowRef<T | undefined>
62
export function shallowRef(value?: unknown) {
63
return createRef(value, true)
0 commit comments