Package: effect
Module: Struct
Retrieves the value at key from a struct.
When to use
Use to extract a single property from a struct in a pipeline.
Details
The return type is narrowed to S[K].
Example (Extracting a property in a pipeline)
import { pipe, Struct } from "effect"
const name = pipe({ name: "Alice", age: 30 }, Struct.get("name"))
console.log(name) // "Alice"
See
keys – list all string keys of a structpick – extract multiple properties into a new structSignature
declare const get: { <S extends object, const K extends keyof S>(key: K): (self: S) => S[K]; <S extends object, const K extends keyof S>(self: S, key: K): S[K]; }
Since v2.0.0