Skip to content

Commit bb6babc

Browse files
authored
perf( runtime-core): use apply to avoid spreading. (#5985)
1 parent 98b83e8 commit bb6babc

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

packages/runtime-core/src/compat/global.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,9 @@ function defineReactive(obj: any, key: string, val: any) {
622622
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
623623
const reactiveVal = reactive(val)
624624
if (isArray(val)) {
625-
methodsToPatch.forEach(m => {
626-
// @ts-expect-error
625+
methodsToPatch.forEach((m: any) => {
627626
val[m] = (...args: any[]) => {
628-
// @ts-expect-error
629-
Array.prototype[m].call(reactiveVal, ...args)
627+
Array.prototype[m].apply(reactiveVal, args)
630628
}
631629
})
632630
} else {

packages/runtime-core/src/compat/instanceEventEmitter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function once(
5353
): ComponentPublicInstance | null {
5454
const wrapped = (...args: any[]) => {
5555
off(instance, event, wrapped)
56-
fn.call(instance.proxy, ...args)
56+
fn.apply(instance.proxy, args)
5757
}
5858
wrapped.fn = fn
5959
on(instance, event, wrapped)

0 commit comments

Comments
 (0)