That is outside of the scope of TypeScript, which is to be a statically typed superset of JavaScript with no runtime cost.
It's easy enough to write a runtime type checking library; I wrote a tiny one that I use in basically all my projects: https://npmjs.com/package/narrows