It is natural to use Array.prototype.filter to filter items with missing information:
type Foo = { prop: string }
const a: Foo[] = [
{ prop: 'bar' },
{ prop: null },
{ prop: 'baz' }
]
a.filter(x => x.prop)
Unfortunately, this does not compile, as filter definition requires the result of the filter function to be strictly boolean. Would it make sense to make the filter definition less strict?
It is natural to use
Array.prototype.filterto filter items with missing information:Unfortunately, this does not compile, as
filterdefinition requires the result of the filter function to be strictly boolean. Would it make sense to make thefilterdefinition less strict?