effex-monorepo
    Preparing search index...

    Variable Readable

    Readable: {
        combine: <T extends readonly Readable<unknown>[]>(
            readables: T,
        ) => Readable<
            {
                [K in string
                | number
                | symbol]: T[K<K>] extends Readable<A> ? A : never
            },
        >;
        dedupe: <A>(self: Readable<A>) => Readable<A>;
        dedupeWith: {
            <A>(
                equals: (a: A, b: A) => boolean,
            ): (self: Readable<A>) => Readable<A>;
            <A>(self: Readable<A>, equals: (a: A, b: A) => boolean): Readable<A>;
        };
        filter: {
            <A>(predicate: (a: A) => boolean): (self: Readable<A>) => Readable<A>;
            <A>(self: Readable<A>, predicate: (a: A) => boolean): Readable<A>;
        };
        flatMap: {
            <A, B>(f: (a: A) => Readable<B>): (self: Readable<A>) => Readable<B>;
            <A, B>(self: Readable<A>, f: (a: A) => Readable<B>): Readable<B>;
        };
        fromStream: <A>(initial: A, stream: Stream<A>) => Readable<A>;
        id: <A>(value: A) => Readable<A>;
        isReadable: (value: unknown) => value is Readable<unknown>;
        lift: <T extends Record<string, unknown>, R>(
            fn: (props: T) => R,
        ) => (
            props: { [K in string | number | symbol]: T[K] | Readable<T[K]> },
        ) => Readable<R>;
        make: <A>(get: Effect<A>, getChanges: () => Stream<A>) => Readable<A>;
        map: {
            <A, B>(f: (a: A) => B): (self: Readable<A>) => Readable<B>;
            <A, B>(self: Readable<A>, f: (a: A) => B): Readable<B>;
        };
        normalize: <A>(value: A | Readable<A>) => Readable<A>;
        of: <A>(value: A) => Readable<A>;
        tap: {
            <A, E, R>(
                f: (a: A) => Effect<void, E, R>,
            ): (self: Readable<A>) => Effect<void, E, Scope | R>;
            <A, E, R>(
                self: Readable<A>,
                f: (a: A) => Effect<void, E, R>,
            ): Effect<void, E, Scope | R>;
        };
        TypeId: symbol;
        zip: {
            <B>(that: Readable<B>): <A>(self: Readable<A>) => Readable<[A, B]>;
            <A, B>(self: Readable<A>, that: Readable<B>): Readable<[A, B]>;
        };
        zipAll: <T extends readonly Readable<unknown>[]>(
            readables: T,
        ) => Readable<
            {
                [K in string
                | number
                | symbol]: T[K<K>] extends Readable<A> ? A : never
            },
        >;
        zipWith: {
            <A, B, C>(
                that: Readable<B>,
                f: (a: A, b: B) => C,
            ): (self: Readable<A>) => Readable<C>;
            <A, B, C>(
                self: Readable<A>,
                that: Readable<B>,
                f: (a: A, b: B) => C,
            ): Readable<C>;
        };
    }

    Type Declaration

    • combine: <T extends readonly Readable<unknown>[]>(
          readables: T,
      ) => Readable<
          {
              [K in string
              | number
              | symbol]: T[K<K>] extends Readable<A> ? A : never
          },
      >

      Alias for zipAll for backwards compatibility.

      Use zipAll instead.

    • dedupe: <A>(self: Readable<A>) => Readable<A>

      Remove consecutive duplicate values using reference equality.

      const input = Readable.of(1);
      const deduped = input.pipe(Readable.dedupe);
    • dedupeWith: {
          <A>(equals: (a: A, b: A) => boolean): (self: Readable<A>) => Readable<A>;
          <A>(self: Readable<A>, equals: (a: A, b: A) => boolean): Readable<A>;
      }

      Remove consecutive duplicate values using a custom equality function.

      const users = Readable.of({ id: 1, name: "John" });
      const deduped = users.pipe(
      Readable.dedupeWith((a, b) => a.id === b.id)
      );
    • filter: {
          <A>(predicate: (a: A) => boolean): (self: Readable<A>) => Readable<A>;
          <A>(self: Readable<A>, predicate: (a: A) => boolean): Readable<A>;
      }

      Filter values from a Readable based on a predicate. Only values that pass the predicate are emitted.

      Note: The initial value must pass the predicate or the Readable will wait for the first passing value.

      const numbers = Readable.of(5);
      const positive = numbers.pipe(Readable.filter(n => n > 0));
    • flatMap: {
          <A, B>(f: (a: A) => Readable<B>): (self: Readable<A>) => Readable<B>;
          <A, B>(self: Readable<A>, f: (a: A) => Readable<B>): Readable<B>;
      }

      Chain Readables by mapping to another Readable and flattening. When the outer Readable changes, switches to the new inner Readable.

      const userId = Readable.of(1);
      const user = userId.pipe(Readable.flatMap(id => getUserReadable(id)));
    • fromStream: <A>(initial: A, stream: Stream<A>) => Readable<A>

      Create a Readable from an initial value and a stream of updates.

    • id: <A>(value: A) => Readable<A>

      Alias for of - creates a constant Readable (identity lift).

    • isReadable: (value: unknown) => value is Readable<unknown>

      Check if a value is a Readable.

    • lift: <T extends Record<string, unknown>, R>(
          fn: (props: T) => R,
      ) => (
          props: { [K in string | number | symbol]: T[K] | Readable<T[K]> },
      ) => Readable<R>

      Lift a function that takes an object as its argument to work with potentially reactive properties.

      const fn = (props: { a: number; b: string }) => `${props.b}-${props.a}`;
      const lifted = Readable.lift(fn);

      const a = Readable.of(42);
      const result = lifted({ a, b: "hello" });
      // result: Readable<string>
    • make: <A>(get: Effect<A>, getChanges: () => Stream<A>) => Readable<A>

      Create a Readable from a getter effect and a changes stream factory.

    • map: {
          <A, B>(f: (a: A) => B): (self: Readable<A>) => Readable<B>;
          <A, B>(self: Readable<A>, f: (a: A) => B): Readable<B>;
      }

      Transform a Readable's value using a mapping function.

      const count = Readable.of(5);
      const doubled = count.pipe(Readable.map(n => n * 2));
      // doubled.get returns 10
    • normalize: <A>(value: A | Readable<A>) => Readable<A>

      Normalize a value that may be static or reactive into a Readable. If the value is already a Readable, returns it unchanged. If the value is static, wraps it in a constant Readable.

      // Normalize a prop that can be static or reactive
      const disabled = Readable.normalize(props.disabled ?? false);
      // disabled is now Readable<boolean>
    • of: <A>(value: A) => Readable<A>

      Create a constant Readable from a value. The Readable always returns the same value and never changes.

      const constant = Readable.of(42);
      // constant.get returns 42, constant.changes is empty
    • tap: {
          <A, E, R>(
              f: (a: A) => Effect<void, E, R>,
          ): (self: Readable<A>) => Effect<void, E, Scope | R>;
          <A, E, R>(
              self: Readable<A>,
              f: (a: A) => Effect<void, E, R>,
          ): Effect<void, E, Scope | R>;
      }

      Run a side effect for each value emitted by the Readable. Subscribes in the background (forked into the current scope) and returns immediately. The subscription is automatically cleaned up when the scope closes.

      yield* Readable.tap(count, (n) => Effect.log(`Count: ${n}`));
      // Subscription runs in background, component continues rendering
    • TypeId: symbol
    • zip: {
          <B>(that: Readable<B>): <A>(self: Readable<A>) => Readable<[A, B]>;
          <A, B>(self: Readable<A>, that: Readable<B>): Readable<[A, B]>;
      }

      Combine two Readables into a Readable of a tuple.

      const name = Readable.of("John");
      const age = Readable.of(30);
      const tuple = name.pipe(Readable.zip(age));
      // tuple: Readable<[string, number]>
    • zipAll: <T extends readonly Readable<unknown>[]>(
          readables: T,
      ) => Readable<
          {
              [K in string
              | number
              | symbol]: T[K<K>] extends Readable<A> ? A : never
          },
      >

      Combine multiple Readables into a single Readable of a tuple. The combined Readable updates whenever any input changes.

      const firstName = Readable.of("John");
      const lastName = Readable.of("Doe");
      const age = Readable.of(30);

      const combined = Readable.zipAll([firstName, lastName, age]);
      // combined: Readable<[string, string, number]>
    • zipWith: {
          <A, B, C>(
              that: Readable<B>,
              f: (a: A, b: B) => C,
          ): (self: Readable<A>) => Readable<C>;
          <A, B, C>(
              self: Readable<A>,
              that: Readable<B>,
              f: (a: A, b: B) => C,
          ): Readable<C>;
      }

      Combine two Readables using a function.

      const firstName = Readable.of("John");
      const lastName = Readable.of("Doe");
      const fullName = firstName.pipe(
      Readable.zipWith(lastName, (first, last) => `${first} ${last}`)
      );