#satisfies

Philip Schönholzerphisch@mastodon.world
2023-03-24

Amazing? Stupid? 🤔 🤪

#typescript #satisfies

const sayOn = ((action) => {
  if (action === 'go') {
    return 'bye'
  }
  return 'hi'
}) satisfies (action: 'go' | 'come') => string

const said = sayOn('go')
//      ^?  const said: "bye" | "hi"
Cefn Hoilecefn
2022-12-03

Finalised my DEV article on exhaustiveness checking in with dev.to/cefn/typescript-satisfi - keen for feedback.

2022-11-29

#typescript 4.9 is only a few days old and I already can't image it without the #satisfies operator anymore lol. If you need help to understand it, watch this youtu.be/Danki1DyiuI?t=247

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst