Closed
Description
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?