effect-io-ai

Package: effect
Module: Chunk

Chunk.Chunk.With

Constructs a Chunk type preserving non-emptiness.

Example (Preserving non-emptiness)

import type { Chunk } from "effect"

declare const regularChunk: Chunk.Chunk<number>
declare const nonEmptyChunk: Chunk.NonEmptyChunk<number>

type WithString1 = Chunk.Chunk.With<typeof regularChunk, string> // Chunk.Chunk<string>
type WithString2 = Chunk.Chunk.With<typeof nonEmptyChunk, string> // Chunk.NonEmptyChunk<string>

Signature

type With<S, A> = S extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A>

Source

Since v2.0.0