<K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<
K,
never
>Determines if a readonly record is empty.
Example (Checking for an empty readonly record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.isEmptyReadonlyRecord({}), true)
assert.deepStrictEqual(Record.isEmptyReadonlyRecord({ a: 3 }), false)export const const isEmptyReadonlyRecord: <
K extends string,
A
>(
self: ReadonlyRecord<K, A>
) => self is ReadonlyRecord<K, never>
Determines if a readonly record is empty.
Example (Checking for an empty readonly record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.isEmptyReadonlyRecord({}), true)
assert.deepStrictEqual(Record.isEmptyReadonlyRecord({ a: 3 }), false)
isEmptyReadonlyRecord: <function (type parameter) K in <K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<K, never>K extends string, function (type parameter) A in <K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<K, never>A>(
self: ReadonlyRecord<K, 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) K in <K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<K, never>K, function (type parameter) A in <K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<K, never>A>
) => self: ReadonlyRecord<K, A>self is 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 <K extends string, A>(self: ReadonlyRecord<K, A>): self is ReadonlyRecord<K, never>K, never> = const isEmptyRecord: <
K extends string,
A
>(
self: Record<K, A>
) => self is Record<K, 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