Reactive-Extensions / RxJS

The Reactive Extensions for JavaScript
http://reactivex.io
Other
19.49k stars 2.1k forks source link

Use keyof T type for pluck operator #1530

Closed FrankiePo closed 6 years ago

FrankiePo commented 6 years ago

Why don't we use typescript's keyof operator instead of just string in pluck operator? I'm saying we can convert pluck types from

pluck<T, R>(props: string[]): R {}

To

pluck<T, K extends keyof T>(props: K[]): T[K] {}

This stuff gives us an error on compilation phase for the following code

Rx.Observable.of({
    a: 1,
    b: 2,
}).pluck('c')

Is it a good idea to implement this?