{
  "id": "@typed/fx/Fx#observeLayer",
  "canonicalId": "@typed/fx/Fx#observeLayer",
  "symbol": {
    "id": "@typed/fx/Fx#observeLayer",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "observeLayer",
    "kind": "constant",
    "signatures": [
      "export declare const observeLayer: {\n    <A, E2 = never, R2 = never>(f: (value: A) => void | Effect<unknown, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Layer<never, E | E2, Exclude<R | R2, Scope>>;\n    <A, E, R, E2 = never, R2 = never>(fx: Fx<A, E, R>, f: (value: A) => void | Effect<unknown, E2, R2>): Layer<never, E | E2, Exclude<R | R2, Scope>>;\n};"
    ],
    "summary": "Observes the values of an `Fx` stream using a callback function and returns a `Layer`.\nThe callback can return `void` or an `Effect` which will be executed for each value.",
    "sections": {
      "Why": "Observation side effects can be installed as application infrastructure and share\nthe Layer graph's typed dependencies and shutdown behavior.",
      "Ownership and lifetime": "Building the Layer forks `observe(fx, f)` in its scope and completes acquisition\nafter registration. Releasing the Layer interrupts the observer and source. Source\nand callback failures terminate the discarded child Fiber; they do not fail Layer\nacquisition, and this API exposes no Fiber handle from which to await the exit.\nHandle or report those failures inside the source/callback, or use `observe`/`fork`\nwhen the caller must observe them. The annotated `E | E2` Layer error remains in the\npublic type even though this implementation does not propagate the background exit.\n`Scope` is supplied internally; delivery behavior remains that of `observe`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { fromIterable, observeLayer } from \"@typed/fx/Fx\"\n\nconst report = (value: number) =>\n  Effect.try({ try: () => JSON.stringify(BigInt(value)), catch: String }).pipe(\n    Effect.catch((error) => Effect.logError(error))\n  )\nconst LogValues = observeLayer(fromIterable([1, 2]), report)\nconst program = Effect.void.pipe(Effect.provide(LogValues))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/run/observe.ts",
      "line": 205
    },
    "since": "1.0.0",
    "category": "Running effects"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#observeLayer",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "observeLayer",
    "qualifiedName": "observeLayer",
    "declarationKey": "declaration:26ee87766513191899e118ed",
    "family": "variable",
    "signatures": [
      "export declare const observeLayer: {\n    <A, E2 = never, R2 = never>(f: (value: A) => void | Effect<unknown, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Layer<never, E | E2, Exclude<R | R2, Scope>>;\n    <A, E, R, E2 = never, R2 = never>(fx: Fx<A, E, R>, f: (value: A) => void | Effect<unknown, E2, R2>): Layer<never, E | E2, Exclude<R | R2, Scope>>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 205,
          "column": 14
        },
        "end": {
          "line": 220,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 206,
          "column": 3
        },
        "end": {
          "line": 208,
          "column": 78
        }
      },
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 210,
          "column": 3
        },
        "end": {
          "line": 213,
          "column": 51
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.observeLayer"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:26ee87766513191899e118ed",
    "name": "observeLayer",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const observeLayer: {\n    <A, E2 = never, R2 = never>(f: (value: A) => void | Effect<unknown, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Layer<never, E | E2, Exclude<R | R2, Scope>>;\n    <A, E, R, E2 = never, R2 = never>(fx: Fx<A, E, R>, f: (value: A) => void | Effect<unknown, E2, R2>): Layer<never, E | E2, Exclude<R | R2, Scope>>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/run/observe.ts",
            "start": {
              "line": 205,
              "column": 14
            },
            "end": {
              "line": 220,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, E2 = never, R2 = never>(f: (value: A) => void | Effect<unknown, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Layer<never, E | E2, Exclude<R | R2, Scope>>;",
          "<A, E, R, E2 = never, R2 = never>(fx: Fx<A, E, R>, f: (value: A) => void | Effect<unknown, E2, R2>): Layer<never, E | E2, Exclude<R | R2, Scope>>;"
        ],
        "typeParameters": [
          "A",
          "E2 = never",
          "R2 = never",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/run/observe.ts",
            "start": {
              "line": 206,
              "column": 3
            },
            "end": {
              "line": 208,
              "column": 78
            }
          },
          {
            "file": "packages/fx/src/Fx/run/observe.ts",
            "start": {
              "line": 210,
              "column": 3
            },
            "end": {
              "line": 213,
              "column": 51
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const observeLayer: {\n    <A, E2 = never, R2 = never>(f: (value: A) => void | Effect<unknown, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Layer<never, E | E2, Exclude<R | R2, Scope>>;\n    <A, E, R, E2 = never, R2 = never>(fx: Fx<A, E, R>, f: (value: A) => void | Effect<unknown, E2, R2>): Layer<never, E | E2, Exclude<R | R2, Scope>>;\n};"
    ],
    "typeParameters": [
      "A",
      "E2 = never",
      "R2 = never",
      "E",
      "R"
    ],
    "summary": "Observes the values of an `Fx` stream using a callback function and returns a `Layer`.\nThe callback can return `void` or an `Effect` which will be executed for each value.",
    "sections": {
      "Why": "Observation side effects can be installed as application infrastructure and share\nthe Layer graph's typed dependencies and shutdown behavior.",
      "Ownership and lifetime": "Building the Layer forks `observe(fx, f)` in its scope and completes acquisition\nafter registration. Releasing the Layer interrupts the observer and source. Source\nand callback failures terminate the discarded child Fiber; they do not fail Layer\nacquisition, and this API exposes no Fiber handle from which to await the exit.\nHandle or report those failures inside the source/callback, or use `observe`/`fork`\nwhen the caller must observe them. The annotated `E | E2` Layer error remains in the\npublic type even though this implementation does not propagate the background exit.\n`Scope` is supplied internally; delivery behavior remains that of `observe`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { fromIterable, observeLayer } from \"@typed/fx/Fx\"\n\nconst report = (value: number) =>\n  Effect.try({ try: () => JSON.stringify(BigInt(value)), catch: String }).pipe(\n    Effect.catch((error) => Effect.logError(error))\n  )\nconst LogValues = observeLayer(fromIterable([1, 2]), report)\nconst program = Effect.void.pipe(Effect.provide(LogValues))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 205,
          "column": 14
        },
        "end": {
          "line": 220,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 206,
          "column": 3
        },
        "end": {
          "line": 208,
          "column": 78
        }
      },
      {
        "file": "packages/fx/src/Fx/run/observe.ts",
        "start": {
          "line": 210,
          "column": 3
        },
        "end": {
          "line": 213,
          "column": 51
        }
      }
    ],
    "since": "1.0.0",
    "category": "Running effects"
  }
}
