@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
md 574 Bytes

Generators

Effect.gen: Passing this

In v3, you could pass a self value directly as the first argument to Effect.gen. In v4, self must be wrapped in an options object.

v3

import { Effect } from "effect"

class MyService {
  readonly local = 1
  compute = Effect.gen(this, function*() {
    return yield* Effect.succeed(this.local + 1)
  })
}

v4

import { Effect } from "effect"

class MyService {
  readonly local = 1
  compute = Effect.gen({ self: this }, function*() {
    return yield* Effect.succeed(this.local + 1)
  })
}