Comment Comment by drabinowitz Type guards also allow you to use Array.prototype.filter to modify the type of an array ie const maybePets: Array<Pet | undefined> = [...] const pets: Array<Pet> = maybePets.filter((v: Pet | undefined): v is Pet => v != undefined) Will compile without errors. parent drabinowitz 7 years ago