effect-io-ai

Package: effect
Module: Array

Array.ReadonlyArray.Infer

Infers the element type of an iterable.

Example (Inferring an element type)

import type { Array } from "effect"

type StringArrayType = Array.ReadonlyArray.Infer<ReadonlyArray<string>>
// StringArrayType is string

Signature

type Infer<S> = S extends ReadonlyArray<infer A> ? A
    : S extends Iterable<infer A> ? A
    : never

Source

Since v2.0.0