Skip to content

Commit a987bc1

Browse files
authored
Update ref.ts
1 parent 1de486c commit a987bc1

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/v3/reactivity/ref.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export function isRef(r: any): r is Ref {
4040
return !!(r && (r as Ref).__v_isRef === true)
4141
}
4242

43-
export function ref<T extends object>(
44-
value: T
45-
): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>
43+
export function ref<T extends Ref>(value: T): T
4644
export function ref<T>(value: T): Ref<UnwrapRef<T>>
4745
export function ref<T = any>(): Ref<T | undefined>
4846
export function ref(value?: unknown) {
@@ -53,9 +51,8 @@ declare const ShallowRefMarker: unique symbol
5351

5452
export type ShallowRef<T = any> = Ref<T> & { [ShallowRefMarker]?: true }
5553

56-
export function shallowRef<T extends object>(
57-
value: T
58-
): [T] extends [Ref] ? T : ShallowRef<T>
54+
export function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T>
55+
export function shallowRef<T extends Ref>(value: T): T
5956
export function shallowRef<T>(value: T): ShallowRef<T>
6057
export function shallowRef<T = any>(): ShallowRef<T | undefined>
6158
export function shallowRef(value?: unknown) {

0 commit comments

Comments
 (0)