Yeah, that's really something that feels like it should be a part of the language, because it would be so useful!
> Add or rely on run-time type information in programs, or emit different code based on the results of the type system. Instead, encourage programming patterns that do not require run-time metadata.
[1] https://github.com/Microsoft/TypeScript/wiki/TypeScript-Desi...