Skip to content

Commit 643ff23

Browse files
authored
types(reactivity): add undefined type to ref/shallowRef when no args (#791)
1 parent a306658 commit 643ff23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/reactivity/src/ref.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export function isRef(r: any): r is Ref {
2929
}
3030

3131
export function ref<T>(value: T): T extends Ref ? T : Ref<UnwrapRef<T>>
32-
export function ref<T = any>(): Ref<T>
32+
export function ref<T = any>(): Ref<T | undefined>
3333
export function ref(value?: unknown) {
3434
return createRef(value)
3535
}
3636

3737
export function shallowRef<T>(value: T): T extends Ref ? T : Ref<T>
38-
export function shallowRef<T = any>(): Ref<T>
38+
export function shallowRef<T = any>(): Ref<T | undefined>
3939
export function shallowRef(value?: unknown) {
4040
return createRef(value, true)
4141
}

0 commit comments

Comments
 (0)