Typescript Filter Undefined. Str undefined. Pen undefined null getPens const pens psfilterisPen typescript knows that pens is Pen.
After this predicate the remaining type either does not have the checked property or it is undefined. Item is ItemWithTitle. X is number.
Dec 14 2017 TypeScript Version.
Instead you should make use of a type-guard egfilterx. Str null. The function you provide to the filter method just returns boolean it does not tell the compiler anything about the types it cant be used to narrow the types. X is number.