TypeScript: Control flow analysis for destructured discriminated unions
One thing I&#x27;m wondering: with all the bells and whistles and insanely complex things TS now supports, why does it still fail to catch seemingly simple mistakes?<p>For instance, it&#x27;s sooo easy to write a React component taking in another component as a prop and some props for that other component, to rendering it. But somehow lose the type safety of the props being passed in. Like, you write some generics and the compiler stops complaining inside your component. But if you go back out and then try to pass some weird props instead, it doesn&#x27;t care. I feel it&#x27;s too easy to write code that looks tyoe safe but subtly isn&#x27;t.