Skip to content

Commit ba8eef1

Browse files
committed
fix(type): fix incorrect ref unwrap, resolve #257
1 parent d1715e4 commit ba8eef1

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
@@ -112,6 +112,8 @@ export function createRef<T>(options: RefOption<T>) {
112112

113113
type RefValue<T> = T extends Ref<infer V> ? V : UnwrapRef<T>;
114114

115+
export function ref<T extends object>(value: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
116+
export function ref<T>(value: T): Ref<UnwrapRef<T>>;
115117
// without init value, explicit typed: a = ref<{ a: number }>()
116118
// typeof a will be Ref<{ a: number } | undefined>
117119
export function ref<T = undefined>(): Ref<T | undefined>;

0 commit comments

Comments
 (0)