Package: effect
Module: Chunk
Creates a non-empty Chunk if either input is non-empty.
Example (Preserving non-emptiness from either input)
import type { Chunk } from "effect"
declare const emptyChunk: Chunk.Chunk<number>
declare const nonEmptyChunk: Chunk.NonEmptyChunk<number>
type Result1 = Chunk.Chunk.OrNonEmpty<
typeof emptyChunk,
typeof emptyChunk,
string
> // Chunk.Chunk<string>
type Result2 = Chunk.Chunk.OrNonEmpty<
typeof emptyChunk,
typeof nonEmptyChunk,
string
> // Chunk.NonEmptyChunk<string>
type Result3 = Chunk.Chunk.OrNonEmpty<
typeof nonEmptyChunk,
typeof emptyChunk,
string
> // Chunk.NonEmptyChunk<string>
Signature
type OrNonEmpty<S, T, A> = S extends NonEmptyChunk<any> ?
NonEmptyChunk<A>
: T extends NonEmptyChunk<any> ? NonEmptyChunk<A>
: Chunk<A>
Since v2.0.0