effect-io-ai

Package: effect
Module: Types

Types.Covariant

Function-type alias encoding covariant variance for a phantom type parameter.

When to use

Use as a phantom field type to make a type parameter covariant in output position.

Details

Covariant<A> is assignable to Covariant<B> when A extends B, following the subtype direction.

Example (Defining a covariant phantom type)

import type { Types } from "effect"

interface Producer<T> {
  readonly _phantom: Types.Covariant<T>
  readonly get: () => T
}

See

Signature

type Covariant<A> = (_: never) => A

Source

Since v2.0.0