https://github.com/tc39/proposal-pattern-matching
Also there has been movement in the user land space with libraries like ts-pattern that make use of new features in typescript 4.x to provide basically the full pattern matching experience:
https://github.com/gvergnaud/ts-pattern
const x: { t: 'A', foo: string } | { t: 'B', bar: string } = /*...*/ return x.t === 'A' ? x.foo : x.bar