# Fx.if

Conditionally runs one of two Fx streams based on the boolean value emitted by the condition stream.

## Signatures

```ts
export { if_ as if };
```

```ts
declare const if_: {
    <B, E2, R2, C, E3, R3>(matchers: {
        onTrue: Fx<B, E2, R2>;
        onFalse: Fx<C, E3, R3>;
    }): <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: {
        onTrue: Fx<B, E2, R2>;
        onFalse: Fx<C, E3, R3>;
    }): Fx<B | C, E | E2 | E3, R | R2 | R3 | Scope>;
};
```

## Why

`if` turns boolean pushes into a switchable branch. Each condition value selects one branch,
interrupts 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;
consumer interruption closes the active work. Failures are delivered to the Sink and only become
terminal when the chosen Sink policy interrupts observation.

## Examples

```ts
import { Fx } from "@typed/fx"
const status = Fx.if(Fx.fromIterable([true, false]), { onTrue: Fx.succeed("on"), onFalse: Fx.succeed("off") })
```
