toMap keySelector type is incorrect
berndfuhrmann opened this issue · comments
berndfuhrmann commented
IxJS version:
5.0.0
Code to reproduce:
import { toMap } from 'ix/iterable';
// ...
const data = [{ key:'alpha', value:true }];
toMap<{ key:string, value:boolean }, string, boolean>(data, { keySelector: (item) => item.key });
Expected behavior:
Typescript should compile this code.
Actual behavior:
While the code itself seems to work, Typescript complains: Type 'string' is not assignable to type 'boolean'.ts(2322)
Additional information:
In https://github.com/ReactiveX/IxJS/blob/master/src/asynciterable/tomap.ts and https://github.com/ReactiveX/IxJS/blob/master/src/iterable/tomap.ts the return value of keySelector
should be TKey
(or sth similar) instead of TElement
.