Skip to content

Commit

Permalink
chore: fix args
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Aug 9, 2024
1 parent daec593 commit a593dde
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/reactivity/src/arrayInstrumentations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ function apply(
wrappedRetFn?: (result: any) => unknown,
) {
const arr = shallowReadArray(self)
// @ts-expect-error
if (arr[method] !== arrayProto[method]) {
// @ts-expect-error
return arr[method](...arrayProto.slice.call(arguments, 2))
let methodFn
// @ts-expect-error our code is limited to es2016 but user code is not
if ((methodFn = arr[method]) !== arrayProto[method]) {
return methodFn.apply(arr, arrayProto.slice.call(arguments, 2))
}

let needsWrap = false
Expand All @@ -258,8 +258,7 @@ function apply(
}
}
}
// @ts-expect-error our code is limited to es2016 but user code is not
const result = arr[method](wrappedFn, thisArg)
const result = methodFn.call(arr, wrappedFn, thisArg)
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result
}

Expand Down

0 comments on commit a593dde

Please sign in to comment.