{
  "id": "@typed/fx#Fx.genScoped",
  "canonicalId": "@typed/fx/Fx#genScoped",
  "symbol": {
    "id": "@typed/fx#Fx.genScoped",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.genScoped",
    "kind": "constant",
    "signatures": [
      "export declare const genScoped: <Yield extends Effect.Effect<any, any, any>, Return extends Fx.Any>(f: () => Generator<Yield, Return, any>) => Fx<Fx.Success<Return>, Fx.Error<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Error<Yield>), Exclude<Fx.Services<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Services<Yield>), Scope.Scope>>;"
    ],
    "summary": "Builds an Fx with a subscription-owned Scope shared by setup and streaming.",
    "sections": {
      "Why": "Resourceful setup must remain alive while the returned producer runs and be\nreleased when that subscription ends. `genScoped` supplies that exact\nacquisition-to-stream lifetime while removing `Scope` from the public\nservice requirement.",
      "Ownership and lifetime": "Every subscription creates one child Scope, runs the generator inside it,\nthen runs the returned Fx in the same Scope. Normal completion, failure,\ndefect, or interruption closes the Scope and its finalizers. Setup failures\nprevent streaming; all non-Scope errors and services remain in the result."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { genScoped } from \"@typed/fx/Fx\"\nimport { succeed } from \"@typed/fx/Fx\"\n\nconst resourceful = genScoped(function* () {\n  const handle = yield* Effect.acquireRelease(\n    Effect.succeed({ open: true }),\n    () => Effect.void\n  )\n  return succeed(handle.open)\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/genScoped.ts",
      "line": 44
    },
    "since": "1.0.0",
    "category": "Generator composition"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.genScoped",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.genScoped",
    "declarationKey": "declaration:a108fe842c055237bc860d29",
    "family": "variable",
    "signatures": [
      "export declare const genScoped: <Yield extends Effect.Effect<any, any, any>, Return extends Fx.Any>(f: () => Generator<Yield, Return, any>) => Fx<Fx.Success<Return>, Fx.Error<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Error<Yield>), Exclude<Fx.Services<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Services<Yield>), Scope.Scope>>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/genScoped.ts",
        "start": {
          "line": 44,
          "column": 14
        },
        "end": {
          "line": 53,
          "column": 33
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#genScoped"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:a108fe842c055237bc860d29"
  },
  "declaration": {
    "declarationKey": "declaration:a108fe842c055237bc860d29",
    "name": "genScoped",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const genScoped: <Yield extends Effect.Effect<any, any, any>, Return extends Fx.Any>(f: () => Generator<Yield, Return, any>) => Fx<Fx.Success<Return>, Fx.Error<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Error<Yield>), Exclude<Fx.Services<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Services<Yield>), Scope.Scope>>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/genScoped.ts",
            "start": {
              "line": 44,
              "column": 14
            },
            "end": {
              "line": 53,
              "column": 33
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const genScoped: <Yield extends Effect.Effect<any, any, any>, Return extends Fx.Any>(f: () => Generator<Yield, Return, any>) => Fx<Fx.Success<Return>, Fx.Error<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Error<Yield>), Exclude<Fx.Services<Return> | ([\n    Yield\n] extends [\n    never\n] ? never : Effect.Services<Yield>), Scope.Scope>>;"
    ],
    "typeParameters": [],
    "summary": "Builds an Fx with a subscription-owned Scope shared by setup and streaming.",
    "sections": {
      "Why": "Resourceful setup must remain alive while the returned producer runs and be\nreleased when that subscription ends. `genScoped` supplies that exact\nacquisition-to-stream lifetime while removing `Scope` from the public\nservice requirement.",
      "Ownership and lifetime": "Every subscription creates one child Scope, runs the generator inside it,\nthen runs the returned Fx in the same Scope. Normal completion, failure,\ndefect, or interruption closes the Scope and its finalizers. Setup failures\nprevent streaming; all non-Scope errors and services remain in the result."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { genScoped } from \"@typed/fx/Fx\"\nimport { succeed } from \"@typed/fx/Fx\"\n\nconst resourceful = genScoped(function* () {\n  const handle = yield* Effect.acquireRelease(\n    Effect.succeed({ open: true }),\n    () => Effect.void\n  )\n  return succeed(handle.open)\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/genScoped.ts",
        "start": {
          "line": 44,
          "column": 14
        },
        "end": {
          "line": 53,
          "column": 33
        }
      }
    ],
    "since": "1.0.0",
    "category": "Generator composition"
  }
}
