{
  "id": "@typed/fx/Fx#if",
  "canonicalId": "@typed/fx/Fx#if",
  "symbol": {
    "id": "@typed/fx/Fx#if",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "if",
    "kind": "constant",
    "signatures": [
      "export { if_ as if };",
      "declare const if_: {\n    <B, E2, R2, C, E3, R3>(matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): <E, R>(condition: Fx<boolean, E, R>) => Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n    <E, R, B, E2, R2, C, E3, R3>(condition: Fx<boolean, E, R>, matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n};"
    ],
    "summary": "Conditionally runs one of two Fx streams based on the boolean value emitted by the condition stream.",
    "sections": {
      "Why": "`if` turns boolean pushes into a switchable branch. Each condition value selects one branch,\ninterrupts the previous branch, and forwards only values from the currently selected Fx.",
      "Ownership and lifetime": "The required Scope owns the active branch. Replacement interrupts and awaits the previous branch;\nconsumer interruption closes the active work. Failures are delivered to the Sink and only become\nterminal when the chosen Sink policy interrupts observation."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nconst status = Fx.if(Fx.fromIterable([true, false]), { onTrue: Fx.succeed(\"on\"), onFalse: Fx.succeed(\"off\") })"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/when.ts",
      "line": 32
    },
    "since": "1.0.0",
    "category": "Conditional sources"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#if",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "if",
    "qualifiedName": "if",
    "declarationKey": "declaration:6e02d389f9ea43fc5891612e",
    "family": "variable",
    "signatures": [
      "export { if_ as if };",
      "declare const if_: {\n    <B, E2, R2, C, E3, R3>(matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): <E, R>(condition: Fx<boolean, E, R>) => Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n    <E, R, B, E2, R2, C, E3, R3>(condition: Fx<boolean, E, R>, matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 32,
          "column": 7
        },
        "end": {
          "line": 58,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 33,
          "column": 3
        },
        "end": {
          "line": 36,
          "column": 91
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 44,
          "column": 50
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.if"
    ],
    "isAlias": true,
    "static": false,
    "importedFrom": "declaration:6e02d389f9ea43fc5891612e"
  },
  "declaration": {
    "declarationKey": "declaration:6e02d389f9ea43fc5891612e",
    "name": "if_",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "declare const if_: {\n    <B, E2, R2, C, E3, R3>(matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): <E, R>(condition: Fx<boolean, E, R>) => Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n    <E, R, B, E2, R2, C, E3, R3>(condition: Fx<boolean, E, R>, matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/when.ts",
            "start": {
              "line": 32,
              "column": 7
            },
            "end": {
              "line": 58,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, E2, R2, C, E3, R3>(matchers: {\n    onTrue: Fx<B, E2, R2>;\n    onFalse: Fx<C, E3, R3>;\n}): <E, R>(condition: Fx<boolean, E, R>) => Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;",
          "<E, R, B, E2, R2, C, E3, R3>(condition: Fx<boolean, E, R>, matchers: {\n    onTrue: Fx<B, E2, R2>;\n    onFalse: Fx<C, E3, R3>;\n}): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;"
        ],
        "typeParameters": [
          "B",
          "E2",
          "R2",
          "C",
          "E3",
          "R3",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/when.ts",
            "start": {
              "line": 33,
              "column": 3
            },
            "end": {
              "line": 36,
              "column": 91
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/when.ts",
            "start": {
              "line": 38,
              "column": 3
            },
            "end": {
              "line": 44,
              "column": 50
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "declare const if_: {\n    <B, E2, R2, C, E3, R3>(matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): <E, R>(condition: Fx<boolean, E, R>) => Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n    <E, R, B, E2, R2, C, E3, R3>(condition: Fx<boolean, E, R>, matchers: {\n        onTrue: Fx<B, E2, R2>;\n        onFalse: Fx<C, E3, R3>;\n    }): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;\n};"
    ],
    "typeParameters": [
      "B",
      "E2",
      "R2",
      "C",
      "E3",
      "R3",
      "E",
      "R"
    ],
    "summary": "Conditionally runs one of two Fx streams based on the boolean value emitted by the condition stream.",
    "sections": {
      "Why": "`if` turns boolean pushes into a switchable branch. Each condition value selects one branch,\ninterrupts the previous branch, and forwards only values from the currently selected Fx.",
      "Ownership and lifetime": "The required Scope owns the active branch. Replacement interrupts and awaits the previous branch;\nconsumer interruption closes the active work. Failures are delivered to the Sink and only become\nterminal when the chosen Sink policy interrupts observation."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\nconst status = Fx.if(Fx.fromIterable([true, false]), { onTrue: Fx.succeed(\"on\"), onFalse: Fx.succeed(\"off\") })"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 32,
          "column": 7
        },
        "end": {
          "line": 58,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 33,
          "column": 3
        },
        "end": {
          "line": 36,
          "column": 91
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/when.ts",
        "start": {
          "line": 38,
          "column": 3
        },
        "end": {
          "line": 44,
          "column": 50
        }
      }
    ],
    "since": "1.0.0",
    "category": "Conditional sources"
  }
}
