TypeScript 7 · Types

Get a type from a value

Derive a type from a runtime value so they can't drift apart.

const defaults = { retries: 3, verbose: false };
type Options = typeof defaults;

Official TypeScript 7 documentation

More types commands

All types commands · TypeScript 7 cheatsheet

Was this page helpful?