<K1 extends string, A, B, C>(
that: ReadonlyRecord<K1, B>,
combine: (selfValue: A, thatValue: B) => C
): <K0 extends string>(
self: ReadonlyRecord<K0, A>
) => Record<K0 | K1, A | B | C>
<K0 extends string, A, K1 extends string, B, C>(
self: ReadonlyRecord<K0, A>,
that: ReadonlyRecord<K1, B>,
combine: (selfValue: A, thatValue: B) => C
): Record<K0 | K1, A | B | C>Merges two records, preserving entries that exist in either of the records. For keys that exist in both records, the provided combine function is used to merge the values.
Example (Merging records with union)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
Record.union({ a: 1, b: 2 }, { b: 3, c: 4 }, (a, b) => a + b),
{ a: 1, b: 5, c: 4 }
)export const const union: {
<K1 extends string, A, B, C>(
that: ReadonlyRecord<K1, B>,
combine: (selfValue: A, thatValue: B) => C
): <K0 extends string>(
self: ReadonlyRecord<K0, A>
) => Record<K0 | K1, A | B | C>
<K0 extends string, A, K1 extends string, B, C>(
self: ReadonlyRecord<K0, A>,
that: ReadonlyRecord<K1, B>,
combine: (selfValue: A, thatValue: B) => C
): Record<K0 | K1, A | B | C>
}
Merges two records, preserving entries that exist in either of the records.
For keys that exist in both records, the provided combine function is used to merge the values.
Example (Merging records with union)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
Record.union({ a: 1, b: 2 }, { b: 3, c: 4 }, (a, b) => a + b),
{ a: 1, b: 5, c: 4 }
)
union: {
<function (type parameter) K1 in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>K1 extends string, function (type parameter) A in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>A, function (type parameter) B in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>B, function (type parameter) C in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>C>(
that: ReadonlyRecord<K1, B>that: 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) K1 in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>K1, function (type parameter) B in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>B>,
combine: (selfValue: A, thatValue: B) => Ccombine: (selfValue: AselfValue: function (type parameter) A in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>A, thatValue: BthatValue: function (type parameter) B in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>B) => function (type parameter) C in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>C
): <function (type parameter) K0 in <K0 extends string>(self: ReadonlyRecord<K0, A>): Record<K0 | K1, A | B | C>K0 extends string>(self: ReadonlyRecord<K0, A>self: 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) K0 in <K0 extends string>(self: ReadonlyRecord<K0, A>): Record<K0 | K1, A | B | C>K0, function (type parameter) A in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>A>) => type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<function (type parameter) K0 in <K0 extends string>(self: ReadonlyRecord<K0, A>): Record<K0 | K1, A | B | C>K0 | function (type parameter) K1 in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>K1, function (type parameter) A in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>A | function (type parameter) B in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>B | function (type parameter) C in <K1 extends string, A, B, C>(that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>C>
<function (type parameter) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0 extends string, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A, function (type parameter) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1 extends string, function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B, function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C>(
self: ReadonlyRecord<K0, A>self: 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) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A>,
that: ReadonlyRecord<K1, B>that: 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) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1, function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B>,
combine: (selfValue: A, thatValue: B) => Ccombine: (selfValue: AselfValue: function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A, thatValue: BthatValue: function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B) => function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C
): type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<function (type parameter) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0 | function (type parameter) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A | function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B | function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C>
} = import dualdual(
3,
<function (type parameter) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0 extends string, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A, function (type parameter) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1 extends string, function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B, function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C>(
self: ReadonlyRecord<K0, A>self: 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) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A>,
that: ReadonlyRecord<K1, B>that: 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) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1, function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B>,
combine: (selfValue: A, thatValue: B) => Ccombine: (selfValue: AselfValue: function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A, thatValue: BthatValue: function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B) => function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C
): type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<function (type parameter) K0 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K0 | function (type parameter) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A | function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B | function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C> => {
if (const isEmptyRecord: <K0, A>(
self: Record<K0, A>
) => self is Record<K0, never>
Determines if a mutable record is empty.
Example (Checking for an empty record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.isEmptyRecord({}), true)
assert.deepStrictEqual(Record.isEmptyRecord({ a: 3 }), false)
isEmptyRecord(self: ReadonlyRecord<K0, A>self)) {
return { ...that: ReadonlyRecord<K1, B>that } as any
}
if (const isEmptyRecord: <K1, B>(
self: Record<K1, B>
) => self is Record<K1, never>
Determines if a mutable record is empty.
Example (Checking for an empty record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.isEmptyRecord({}), true)
assert.deepStrictEqual(Record.isEmptyRecord({ a: 3 }), false)
isEmptyRecord(that: ReadonlyRecord<K1, B>that)) {
return { ...self: ReadonlyRecord<K0, A>self } as any
}
const const out: Record<string, A | B | C>out: type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, function (type parameter) A in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>A | function (type parameter) B in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>B | function (type parameter) C in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>C> = const empty: <string, A | B | C>() => Record<string, A | B | C>Creates a new, empty record.
Example (Creating an empty record)
import { Record } from "effect"
// Create an empty record
const emptyRecord = Record.empty<string, number>()
console.log(emptyRecord) // {}
// The type ensures type safety for future operations
const withValue = Record.set(emptyRecord, "count", 42)
console.log(withValue) // { count: 42 }
empty()
for (const const key: K0 extends stringkey of const keys: <
K extends string | symbol,
A
>(
self: ReadonlyRecord<K, A>
) => Array<K & string>
Retrieves the keys of a given record as an array.
Example (Getting record keys)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.keys({ a: 1, b: 2, c: 3 }), ["a", "b", "c"])
keys(self: ReadonlyRecord<K0, A>self)) {
if (const has: {
<K extends string | symbol>(key: NoInfer<K>): <
A
>(
self: ReadonlyRecord<K, A>
) => boolean
<K extends string | symbol, A>(
self: ReadonlyRecord<K, A>,
key: NoInfer<K>
): boolean
}
has(that: ReadonlyRecord<K1, B>that, const key: K0 extends stringkey as any)) {
const out: Record<string, A | B | C>out[const key: K0 extends stringkey] = combine: (selfValue: A, thatValue: B) => Ccombine(self: ReadonlyRecord<K0, A>self[const key: K0 extends stringkey], that: ReadonlyRecord<K1, B>that[const key: K0 extends stringkey as unknown as function (type parameter) K1 in <K0 extends string, A, K1 extends string, B, C>(self: ReadonlyRecord<K0, A>, that: ReadonlyRecord<K1, B>, combine: (selfValue: A, thatValue: B) => C): Record<K0 | K1, A | B | C>K1])
} else {
const out: Record<string, A | B | C>out[const key: K0 extends stringkey] = self: ReadonlyRecord<K0, A>self[const key: K0 extends stringkey]
}
}
for (const const key: K1 extends stringkey of const keys: <
K extends string | symbol,
A
>(
self: ReadonlyRecord<K, A>
) => Array<K & string>
Retrieves the keys of a given record as an array.
Example (Getting record keys)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.keys({ a: 1, b: 2, c: 3 }), ["a", "b", "c"])
keys(that: ReadonlyRecord<K1, B>that)) {
if (!const has: {
<K extends string | symbol>(key: NoInfer<K>): <
A
>(
self: ReadonlyRecord<K, A>
) => boolean
<K extends string | symbol, A>(
self: ReadonlyRecord<K, A>,
key: NoInfer<K>
): boolean
}
has(const out: Record<string, A | B | C>out, const key: K1 extends stringkey)) {
const out: Record<string, A | B | C>out[const key: K1 extends stringkey] = that: ReadonlyRecord<K1, B>that[const key: K1 extends stringkey]
}
}
return const out: Record<string, A | B | C>out
}
)