diff --git a/packages/reactivity/src/effect.ts b/packages/reactivity/src/effect.ts index 03f8e510..eb06a63a 100644 --- a/packages/reactivity/src/effect.ts +++ b/packages/reactivity/src/effect.ts @@ -10,7 +10,7 @@ type KeyToDepMap = Map const targetMap = new WeakMap() export interface ReactiveEffect { - (...args: any[]): T + (): T _isEffect: true id: number active: boolean @@ -77,12 +77,12 @@ export function stop(effect: ReactiveEffect) { let uid = 0 function createReactiveEffect( - fn: (...args: any[]) => T, + fn: () => T, options: ReactiveEffectOptions ): ReactiveEffect { - const effect = function reactiveEffect(...args: unknown[]): unknown { + const effect = function reactiveEffect(): unknown { if (!effect.active) { - return options.scheduler ? undefined : fn(...args) + return options.scheduler ? undefined : fn() } if (!effectStack.includes(effect)) { cleanup(effect) @@ -90,7 +90,7 @@ function createReactiveEffect( enableTracking() effectStack.push(effect) activeEffect = effect - return fn(...args) + return fn() } finally { effectStack.pop() resetTracking()