Package: effect
Module: Struct
Returns the string keys of a struct as a properly typed Array<keyof S & string>.
When to use
Use when you want a typed replacement for Object.keys that narrows the result
to the known string keys of the struct.
Gotchas
Symbol keys are excluded; only string keys are returned.
Example (Reading typed keys)
import { Struct } from "effect"
const user = { name: "Alice", age: 30, [Symbol.for("id")]: 1 }
const k: Array<"name" | "age"> = Struct.keys(user)
console.log(k) // ["name", "age"]
See
get – access a single key’s valuepick – select a subset of keys into a new structSignature
declare const keys: <S extends object>(self: S) => Array<(keyof S) & string>
Since v3.6.0