Open joux3 opened 5 years ago
This is a nice idea! Want to have a stab at this yourself?
Filter is a bit hard to modify, because it's already quite overloaded:
filter(f: Predicate<V> | boolean | Property<boolean>): this
A new operator on EventStream and Property can be added though:
narrow<V2 extends V>(f: IsA<V, V2>): EventStream<V2> {
return <any>filter<V>(this, f)
}
What should we call it?
WIP at 745de93ddeaae39537bf494eb2a9b7adbc3a2d25
Array.filter
can change the type of the array when passed a user-defined type guard. See for example this:Could
Observable.filter
support a similar type guard? The type definition forArray.filter
in the example is: