fix: Revert "fix(types/ref): correct type inference for nested refs (#11536)"

This reverts commit 536f62332c.
This commit is contained in:
Evan You 2024-08-07 18:11:39 +08:00
parent 978ff3c1db
commit 3a56315f94
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
2 changed files with 1 additions and 8 deletions

View File

@ -180,11 +180,6 @@ describe('allow getter and setter types to be unrelated', <T>() => {
const d = {} as T const d = {} as T
const e = ref(d) const e = ref(d)
e.value = d e.value = d
const f = ref(ref(0))
expectType<number>(f.value)
// @ts-expect-error
f.value = ref(1)
}) })
// shallowRef // shallowRef

View File

@ -109,9 +109,7 @@ export function isRef(r: any): r is Ref {
* @param value - The object to wrap in the ref. * @param value - The object to wrap in the ref.
* @see {@link https://vuejs.org/api/reactivity-core.html#ref} * @see {@link https://vuejs.org/api/reactivity-core.html#ref}
*/ */
export function ref<T>( export function ref<T>(value: T): Ref<UnwrapRef<T>, UnwrapRef<T> | T>
value: T,
): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>
export function ref<T = any>(): Ref<T | undefined> export function ref<T = any>(): Ref<T | undefined>
export function ref(value?: unknown) { export function ref(value?: unknown) {
return createRef(value, false) return createRef(value, false)