Skip to content

QuizNot attempted

satisfies

What does satisfies give you over a type annotation?
const routes = { home: '/', user: '/user/:id' } satisfies Record<string, string>;
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • It checks the value against the type but keeps the narrower inferred type (routes.home is still known as a key)
  • satisfies checks the value against the type but keeps the narrower inferred type, so routes.home is still a known key and routes.nope is an error.
  • Not 'casts like as': as skips the check, satisfies enforces it.
  • Not readonly: that is as const or Readonly<>.
  • Not an alias for ':': an annotation widens to Record<string, string>, losing the literal keys.