https://github.com/microsoft/TypeScript/pull/50666 The next version of TypeScript will have a very useful feature. Now you can check typeof obj === "object" && obj !== null && 'foo' in obj && typeof obj.foo === "string" and TS will know that obj.foo is a string and let you work with it even when the type of obj is unknown.