Hyperlinkv0.8.0-beta.28

Struct

Struct.Applytypeeffect/Struct.ts:619
Apply<L, V>

Applies a Lambda type-level function to a value type V, producing the output type.

When to use

Use when you need to compute what type a Lambda would produce for a given input.

Details

This works by intersecting the Lambda with { "~lambda.in": V } and reading "~lambda.out".

Example (Computing the output type of a lambda)

import type { Struct } from "effect"

interface ToString extends Struct.Lambda {
  readonly "~lambda.out": string
}

// Result is `string`
type Result = Struct.Apply<ToString, number>
LambdaLambda
Source effect/Struct.ts:6191 lines
export type Apply<L extends Lambda, V> = (L & { readonly "~lambda.in": V })["~lambda.out"]
Referenced by 6 symbols