Reactive-Extensions / RxJS

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

Add pluck keyof type for prop #1530 #1533

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')
msftclas commented 6 years ago

CLA assistant check
All CLA requirements met.

FrankiePo commented 6 years ago

see also advanced-types