refactor(reactivity): reduce variable access (#4366)
This commit is contained in:
parent
c68cba82ea
commit
d8da4214fc
@ -221,9 +221,8 @@ export function toRef<T extends object, K extends keyof T>(
|
|||||||
object: T,
|
object: T,
|
||||||
key: K
|
key: K
|
||||||
): ToRef<T[K]> {
|
): ToRef<T[K]> {
|
||||||
return isRef(object[key])
|
const val = object[key]
|
||||||
? object[key]
|
return isRef(val) ? val : (new ObjectRefImpl(object, key) as any)
|
||||||
: (new ObjectRefImpl(object, key) as any)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// corner case when use narrows type
|
// corner case when use narrows type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user