<K extends string | symbol, A>(key: K, value: A): Record<K, A>Create a non-empty record from a single element.
Example (Creating a singleton record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.singleton("a", 1), { a: 1 })constructors
Source effect/Record.ts:14503 lines
export const const singleton: <
K extends string | symbol,
A
>(
key: K,
value: A
) => Record<K, A>
Create a non-empty record from a single element.
Example (Creating a singleton record)
import { Record } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Record.singleton("a", 1), { a: 1 })
singleton = <function (type parameter) K in <K extends string | symbol, A>(key: K, value: A): Record<K, A>K extends string | symbol, function (type parameter) A in <K extends string | symbol, A>(key: K, value: A): Record<K, A>A>(key: K extends string | symbolkey: function (type parameter) K in <K extends string | symbol, A>(key: K, value: A): Record<K, A>K, value: Avalue: function (type parameter) A in <K extends string | symbol, A>(key: K, value: A): Record<K, A>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) K in <K extends string | symbol, A>(key: K, value: A): Record<K, A>K, function (type parameter) A in <K extends string | symbol, A>(key: K, value: A): Record<K, A>A> => ({
[key: K extends string | symbolkey]: value: Avalue
} as any)