ReadonlyRecordTypeLambda<K>Type lambda for readonly records, used in higher-kinded type operations. This enables records to work with generic type constructors and functors.
Example (Applying a readonly record type lambda)
import type { HKT, Record } from "effect"
type Settings = HKT.Kind<
Record.ReadonlyRecordTypeLambda<"port" | "retries">,
never,
never,
never,
number
>
const defaults: Settings = {
port: 3000,
retries: 3
}export interface interface ReadonlyRecordTypeLambda<K extends string = string>Type lambda for readonly records, used in higher-kinded type operations.
This enables records to work with generic type constructors and functors.
Example (Applying a readonly record type lambda)
import type { HKT, Record } from "effect"
type Settings = HKT.Kind<
Record.ReadonlyRecordTypeLambda<"port" | "retries">,
never,
never,
never,
number
>
const defaults: Settings = {
port: 3000,
retries: 3
}
ReadonlyRecordTypeLambda<function (type parameter) K in ReadonlyRecordTypeLambda<K extends string = string>K extends string = string> extends import TypeLambdaTypeLambda {
readonly ReadonlyRecordTypeLambda<K extends string = string>.type: ReadonlyRecord<K, this["Target"]>type: type ReadonlyRecord<in out K extends string | symbol, out A> = { readonly [P in K]: A; }Represents a readonly record with keys of type K and values of type A.
This is the foundational type for immutable key-value mappings in Effect.
Example (Defining a readonly record type)
import type { Record } from "effect"
// Creating a readonly record type
type UserRecord = Record.ReadonlyRecord<"name" | "age", string | number>
const user: UserRecord = {
name: "John",
age: 30
}
Namespace containing utility types for working with readonly records.
These types help with type-level operations on record keys and values.
Example (Using readonly record helper types)
import type { Record } from "effect"
// Using NonLiteralKey to convert literal keys to generic types
type GenericKey = Record.ReadonlyRecord.NonLiteralKey<"foo" | "bar"> // string
// Using IntersectKeys to find common keys between record types
type CommonKeys = Record.ReadonlyRecord.IntersectKeys<"a" | "b", "b" | "c"> // "b"
ReadonlyRecord<function (type parameter) K in ReadonlyRecordTypeLambda<K extends string = string>K, this["Target"]>
}