Skip to content

Commit 3a56315

Browse files
committed
fix: Revert "fix(types/ref): correct type inference for nested refs (vuejs#11536)"
This reverts commit 536f623.
1 parent 978ff3c commit 3a56315

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

packages/dts-test/ref.test-d.ts

-5
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,6 @@ describe('allow getter and setter types to be unrelated', <T>() => {
180180
const d = {} as T
181181
const e = ref(d)
182182
e.value = d
183-
184-
const f = ref(ref(0))
185-
expectType<number>(f.value)
186-
// @ts-expect-error
187-
f.value = ref(1)
188183
})
189184

190185
// shallowRef

packages/reactivity/src/ref.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ export function isRef(r: any): r is Ref {
109109
* @param value - The object to wrap in the ref.
110110
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
111111
*/
112-
export function ref<T>(
113-
value: T,
114-
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>
112+
export function ref<T>(value: T): Ref<UnwrapRef<T>, UnwrapRef<T> | T>
115113
export function ref<T = any>(): Ref<T | undefined>
116114
export function ref(value?: unknown) {
117115
return createRef(value, false)

0 commit comments

Comments
 (0)