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 type Apply<L extends Lambda, V> = (L & {
readonly "~lambda.in": V
})["~lambda.out"]
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>
Apply<function (type parameter) L in type Apply<L extends Lambda, V>L extends Lambda, function (type parameter) V in type Apply<L extends Lambda, V>V> = (function (type parameter) L in type Apply<L extends Lambda, V>L & { readonly "~lambda.in": function (type parameter) V in type Apply<L extends Lambda, V>V })["~lambda.out"]Referenced by 6 symbols