Dev Helpers

TypeScript / Object types

Read a typed property

Dev Helpers · June 28, 2026

A typed property read can couple a key to the shape of its record. That relationship catches misspellings before they become missing runtime values.

Worked example

interface Job {
  id: number;
  name: string;
  done: boolean;
}
const job: Job = { id: 1, name: "Build", done: false };
console.log(job.name.toUpperCase());

Result

BUILD

Implementation notes

A generic key constrained to keyof a record still needs a valid runtime object. Type assertions at the network boundary can undermine this guarantee.

Try it yourself

Rename the property in the type and inspect its callers.

Open the TypeScript example →

Editorial date June 28, 2026 · Published December 6, 2026

Related articles

Create an object with a computed flag

A computed property name derives an object's key from a runtime value. Keep its allowed names narrow if downstream readers expect a fixed set.

Pick two public fields

A public projection should explicitly copy the fields meant for its consumer. A narrower type annotation alone does not remove fields from a runtime object.

Exclude an internal field

Omit describes a narrower type at compile time. Removing an internal field from a payload also requires a runtime projection or destructuring step.