<const Keys extends ReadonlyArray<string | symbol>, Value>(
keys: Keys,
value: Value
): Record<Keys[number], Value>Creates a record with the given keys and value.
When to use
Use to build an object where each provided key receives the same value.
Example (Creating a record)
import { Struct } from "effect"
const record = Struct.Record(["a", "b"], "value")
console.log(record) // { a: "value", b: "value" }constructors
Source effect/Struct.ts:97010 lines
export function function Record<
const Keys extends ReadonlyArray<
string | symbol
>,
Value
>(
keys: Keys,
value: Value
): Record<Keys[number], Value>
Creates a record with the given keys and value.
When to use
Use to build an object where each provided key receives the same value.
Example (Creating a record)
import { Struct } from "effect"
const record = Struct.Record(["a", "b"], "value")
console.log(record) // { a: "value", b: "value" }
Record<const function (type parameter) Keys in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Keys extends interface ReadonlyArray<T>ReadonlyArray<string | symbol>, function (type parameter) Value in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Value>(
keys: const Keys extends ReadonlyArray<string | symbol>keys: function (type parameter) Keys in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Keys,
value: Valuevalue: function (type parameter) Value in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Value
): 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) Keys in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Keys[number], function (type parameter) Value in Record<const Keys extends ReadonlyArray<string | symbol>, Value>(keys: Keys, value: Value): Record<Keys[number], Value>Value> {
const const out: anyout: any = {}
for (const const key: string | symbolkey of keys: const Keys extends ReadonlyArray<string | symbol>keys) {
const out: anyout[const key: string | symbolkey] = value: Valuevalue
}
return const out: anyout
}