(_: never): AFunction-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
}export type type Covariant<A> = (_: never) => AFunction-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
}
Namespace for
Covariant
-related utilities.
When to use
Use when referring to type-level helpers nested under Covariant.
Covariant<function (type parameter) A in type Covariant<A>A> = (_: never_: never) => function (type parameter) A in type Covariant<A>A
/**
* Namespace for {@link Covariant}-related utilities.
*
* **When to use**
*
* Use when referring to type-level helpers nested under `Covariant`.
*
* @since 3.9.0
*/
export declare namespace Covariant {
/**
* Extracts the type parameter `A` from a `Covariant<A>`.
*
* **When to use**
*
* Use to recover the carried type from a covariant phantom marker.
*
* **Example** (Extracting the inner type)
*
* ```ts
* import type { Types } from "effect"
*
* type Inner = Types.Covariant.Type<Types.Covariant<string>>
* // string
* ```
*
* @see {@link Covariant}
*
* @category models
* @since 3.9.0
*/
export type type Covariant<A>.Type<A> = A extends Covariant<infer U> ? U : neverExtracts the type parameter A from a Covariant<A>.
When to use
Use to recover the carried type from a covariant phantom marker.
Example (Extracting the inner type)
import type { Types } from "effect"
type Inner = Types.Covariant.Type<Types.Covariant<string>>
// string
Type<function (type parameter) A in type Covariant<A>.Type<A>A> = function (type parameter) A in type Covariant<A>.Type<A>A extends type Covariant<A> = (_: never) => AFunction-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
}
Namespace for
Covariant
-related utilities.
When to use
Use when referring to type-level helpers nested under Covariant.
Covariant<infer function (type parameter) UU> ? function (type parameter) UU : never
}