fknop / angular-pipes

Useful pipes for Angular
https://fknop.gitbook.io/angular-pipes/
MIT License
732 stars 157 forks source link

Keep types when using pipes #94

Open Diluka opened 5 years ago

Diluka commented 5 years ago

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request

Current behavior

all to any, no types any more

Expected behavior

keep types

Minimal reproduction of the problem with instructions numbers: number[] = [1, 2, 3, 4, 5] numbers | where: 1 is an any[] not number[]

What is the motivation / use case for changing the behavior?

fknop commented 5 years ago

~~I'm not sure it's actually possible with Angular to do this. The transform method on the PipeTransform interface doesn't accept generic type information. https://angular.io/api/core/PipeTransform~~

However, if you find a way, feel free to inform me :)

It looks like it's actually possible (with some issues: https://github.com/angular/angular/issues/21224), however it would require time to do this for all pipes which I don't have right now. Feel free to start a PR.