Is it possible to create a typeguard, or something else that accomplishes the same purpose, to check if a variable is a specific interface type in a typescript union?
Since Typescript 1.6 you can use user-defined type guards:
let isFoo = (object: Foo| Bar): object is Foo => { return "a" in object; }
See https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards and https://github.com/microsoft/TypeScript/issues/10485