Skip to content

Commit

Permalink
fix(reactivity): pass type argument to return type in effect
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Feb 15, 2023
1 parent 78b8615 commit 9b492d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/reactivity/src/effect.ts
Expand Up @@ -170,9 +170,9 @@ export interface ReactiveEffectRunner<T = any> {
export function effect<T = any>(
fn: () => T,
options?: ReactiveEffectOptions
): ReactiveEffectRunner {
if ((fn as ReactiveEffectRunner).effect) {
fn = (fn as ReactiveEffectRunner).effect.fn
): ReactiveEffectRunner<T> {
if ((fn as ReactiveEffectRunner<T>).effect) {
fn = (fn as ReactiveEffectRunner<T>).effect.fn
}

const _effect = new ReactiveEffect(fn)
Expand All @@ -183,7 +183,7 @@ export function effect<T = any>(
if (!options || !options.lazy) {
_effect.run()
}
const runner = _effect.run.bind(_effect) as ReactiveEffectRunner
const runner = _effect.run.bind(_effect) as ReactiveEffectRunner<T>
runner.effect = _effect
return runner
}
Expand Down

0 comments on commit 9b492d3

Please sign in to comment.