TypeScript Compiler Error with Scope in runFork Options and addFinalizer Execution Issue

If i provide the scope into runFork options TS compiler still complains about "Argument of type  Effect<void, never, Scope>  is not assignable to parameter of type  Effect<void, never, never>" and the code above addFinalizer doesn't execute. Looks like it is by design. What i'm doing wrong?
import { Effect, Scope, Exit } from 'effect';

const scope = Effect.runSync(Scope.make());

const prog = Effect.gen(function* () {
  yield* Effect.addFinalizer((exit) => Effect.log('exit', exit))
  yield* Effect.log('running..')
  yield* Effect.never
})

Effect.runFork(prog, { scope })
Effect.runPromise(Scope.close(scope, Exit.void))

I just want to create some class with scope variable and run every effect associated with this class in his scope to be able to stop all of them (by closing his scope) when i want to destroy my class
Was this page helpful?