Hyperlinkv0.8.0-beta.28

Record

Record.singletonconsteffect/Record.ts:1450
<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 singleton = <K extends string | symbol, A>(key: K, value: A): Record<K, A> => ({
  [key]: value
} as any)