Skip to content

Commit 779f37d

Browse files
committed
fix(type): fix incorrect ref unwrap, resolve #257
1 parent 93e0c82 commit 779f37d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/reactivity/ref.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export function createRef<T>(options: RefOption<T>) {
8181

8282
type RefValue<T> = T extends Ref<infer V> ? V : UnwrapRef<T>;
8383

84+
export function ref<T extends object>(value: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
85+
export function ref<T>(value: T): Ref<UnwrapRef<T>>;
8486
// without init value, explicit typed: a = ref<{ a: number }>()
8587
// typeof a will be Ref<{ a: number } | undefined>
8688
export function ref<T = any>(): Ref<T | undefined>;

0 commit comments

Comments
 (0)