{
  "id": "@typed/guard#provide",
  "canonicalId": "@typed/guard#provide",
  "symbol": {
    "id": "@typed/guard#provide",
    "packageName": "@typed/guard",
    "moduleName": ".",
    "exportName": "provide",
    "kind": "constant",
    "signatures": [
      "export declare const provide: {\n    <R2>(provided: Context.Context<R2>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, Exclude<R, R2>>;\n    <R2, E2, R3>(provided: Layer.Layer<R2, E2, R3>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n    <I, O, E, R, R2>(guard: GuardInput<I, O, E, R>, provided: Context.Context<R2>): Guard<I, O, E, Exclude<R, R2>>;\n    <I, O, E, R, R2, E2, R3>(guard: GuardInput<I, O, E, R>, provided: Layer.Layer<R2, E2, R3>): Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "summary": "Provides a Context or Layer to a Guard's Effect.",
    "sections": {
      "Why": "Provision removes supplied services from `R`; Layers may also contribute acquisition errors and their own requirements exactly as Effect does.",
      "Ownership and lifetime": "A Context acquires no resources here. Layer resources are acquired and released according to the Effect Scope that runs the Guard."
    },
    "examples": [
      {
        "language": "text",
        "code": "```ts\nimport { provide } from \"@typed/guard\"\nimport type { Guard } from \"@typed/guard\"\nimport { Context, Effect, Option } from \"effect\"\nconst Flag = Context.Service<{ readonly enabled: boolean }>(\"Flag\")\nconst requiresFlag: Guard<boolean, boolean, never, Context.Service.Identifier<typeof Flag>> = (input) => Effect.map(Effect.service(Flag), ({ enabled }) => enabled && input ? Option.some(input) : Option.none())\nconst guard = provide(requiresFlag, Context.make(Flag, { enabled: true }))\n```\nSee [Effect services and Layers](https://effect.website/docs/requirements-management/layers/)."
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/guard/src/index.ts",
      "line": 784
    },
    "since": "1.0.0",
    "category": "Services"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/guard#provide",
    "packageName": "@typed/guard",
    "packageVersion": "1.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/guard",
    "exportName": "provide",
    "qualifiedName": "provide",
    "declarationKey": "declaration:1240a2dc9ca073a396926c0d",
    "family": "variable",
    "signatures": [
      "export declare const provide: {\n    <R2>(provided: Context.Context<R2>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, Exclude<R, R2>>;\n    <R2, E2, R3>(provided: Layer.Layer<R2, E2, R3>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n    <I, O, E, R, R2>(guard: GuardInput<I, O, E, R>, provided: Context.Context<R2>): Guard<I, O, E, Exclude<R, R2>>;\n    <I, O, E, R, R2, E2, R3>(guard: GuardInput<I, O, E, R>, provided: Layer.Layer<R2, E2, R3>): Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 784,
          "column": 14
        },
        "end": {
          "line": 809,
          "column": 3
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 785,
          "column": 3
        },
        "end": {
          "line": 787,
          "column": 84
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 788,
          "column": 3
        },
        "end": {
          "line": 790,
          "column": 94
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 792,
          "column": 3
        },
        "end": {
          "line": 795,
          "column": 37
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 796,
          "column": 3
        },
        "end": {
          "line": 799,
          "column": 47
        }
      }
    ],
    "aliases": [],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:1240a2dc9ca073a396926c0d",
    "name": "provide",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const provide: {\n    <R2>(provided: Context.Context<R2>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, Exclude<R, R2>>;\n    <R2, E2, R3>(provided: Layer.Layer<R2, E2, R3>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n    <I, O, E, R, R2>(guard: GuardInput<I, O, E, R>, provided: Context.Context<R2>): Guard<I, O, E, Exclude<R, R2>>;\n    <I, O, E, R, R2, E2, R3>(guard: GuardInput<I, O, E, R>, provided: Layer.Layer<R2, E2, R3>): Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/guard/src/index.ts",
            "start": {
              "line": 784,
              "column": 14
            },
            "end": {
              "line": 809,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<R2>(provided: Context.Context<R2>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, Exclude<R, R2>>;",
          "<R2, E2, R3>(provided: Layer.Layer<R2, E2, R3>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, Exclude<R, R2> | R3>;",
          "<I, O, E, R, R2>(guard: GuardInput<I, O, E, R>, provided: Context.Context<R2>): Guard<I, O, E, Exclude<R, R2>>;",
          "<I, O, E, R, R2, E2, R3>(guard: GuardInput<I, O, E, R>, provided: Layer.Layer<R2, E2, R3>): Guard<I, O, E | E2, Exclude<R, R2> | R3>;"
        ],
        "typeParameters": [
          "R2",
          "E2",
          "R3",
          "I",
          "O",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/guard/src/index.ts",
            "start": {
              "line": 785,
              "column": 3
            },
            "end": {
              "line": 787,
              "column": 84
            }
          },
          {
            "file": "packages/guard/src/index.ts",
            "start": {
              "line": 788,
              "column": 3
            },
            "end": {
              "line": 790,
              "column": 94
            }
          },
          {
            "file": "packages/guard/src/index.ts",
            "start": {
              "line": 792,
              "column": 3
            },
            "end": {
              "line": 795,
              "column": 37
            }
          },
          {
            "file": "packages/guard/src/index.ts",
            "start": {
              "line": 796,
              "column": 3
            },
            "end": {
              "line": 799,
              "column": 47
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const provide: {\n    <R2>(provided: Context.Context<R2>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, Exclude<R, R2>>;\n    <R2, E2, R3>(provided: Layer.Layer<R2, E2, R3>): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n    <I, O, E, R, R2>(guard: GuardInput<I, O, E, R>, provided: Context.Context<R2>): Guard<I, O, E, Exclude<R, R2>>;\n    <I, O, E, R, R2, E2, R3>(guard: GuardInput<I, O, E, R>, provided: Layer.Layer<R2, E2, R3>): Guard<I, O, E | E2, Exclude<R, R2> | R3>;\n};"
    ],
    "typeParameters": [
      "R2",
      "E2",
      "R3",
      "I",
      "O",
      "E",
      "R"
    ],
    "summary": "Provides a Context or Layer to a Guard's Effect.",
    "sections": {
      "Why": "Provision removes supplied services from `R`; Layers may also contribute acquisition errors and their own requirements exactly as Effect does.",
      "Ownership and lifetime": "A Context acquires no resources here. Layer resources are acquired and released according to the Effect Scope that runs the Guard."
    },
    "examples": [
      {
        "language": "text",
        "code": "```ts\nimport { provide } from \"@typed/guard\"\nimport type { Guard } from \"@typed/guard\"\nimport { Context, Effect, Option } from \"effect\"\nconst Flag = Context.Service<{ readonly enabled: boolean }>(\"Flag\")\nconst requiresFlag: Guard<boolean, boolean, never, Context.Service.Identifier<typeof Flag>> = (input) => Effect.map(Effect.service(Flag), ({ enabled }) => enabled && input ? Option.some(input) : Option.none())\nconst guard = provide(requiresFlag, Context.make(Flag, { enabled: true }))\n```\nSee [Effect services and Layers](https://effect.website/docs/requirements-management/layers/)."
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 784,
          "column": 14
        },
        "end": {
          "line": 809,
          "column": 3
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 785,
          "column": 3
        },
        "end": {
          "line": 787,
          "column": 84
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 788,
          "column": 3
        },
        "end": {
          "line": 790,
          "column": 94
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 792,
          "column": 3
        },
        "end": {
          "line": 795,
          "column": 37
        }
      },
      {
        "file": "packages/guard/src/index.ts",
        "start": {
          "line": 796,
          "column": 3
        },
        "end": {
          "line": 799,
          "column": 47
        }
      }
    ],
    "since": "1.0.0",
    "category": "Services"
  }
}
