0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

Narrowing overload for `filter` #148

Closed isker closed 1 year ago

isker commented 1 year ago

In TS, Array.filter has an extra overload that supports narrowing the input type with a type predicate: https://github.com/microsoft/TypeScript/blob/29c4b5e231e499cf506ea1c585d979b4d9d0459f/src/lib/es5.d.ts#L1234-L1245

Could wonka's filter do the same? I wonder what flowgen would have to say about it, at least.

kitten commented 1 year ago

Yes! Quite coincidentally, I've just noticed yesterday that the double generic is actually missing 😅 I'll have to see whether it can be added in a patch

isker commented 1 year ago

Cheers!