Extend type guards to filter objects by literal type properties :
  type Name = { kind : "name"; name : string };
  type Id  = { kind : "id"; id : number };
  type Obj = Name | Id;
  var o : obj;
  if (o.kind === "name") {
    /* o is considered as Name */
  } else {
    /* o is considered as Obj - Name */
  }