mihaifm / linq

linq.js - LINQ for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GroupBy<Tkey> has wrong return type

tuan-tu-tran opened this issue · comments

Hi,

First, thanks for this, it's a really cool lib :-)

While I was using it, I noticed that in the typings, the return type for groupBy is odd:

linq/linq.d.ts

Line 121 in 27a8af6

groupBy<TKey>(keySelector: (element: T) => TKey): IEnumerable<IGrouping<TKey, any>>;

// truly, return type is IEnumerable<IGrouping<TKey, T>> but Visual Studio + TypeScript Compiler can't compile.
groupBy<TKey>(keySelector: (element: T) => TKey): IEnumerable<IGrouping<TKey, any>>;

Like the comment says, the true return type should be using T instead of any.
But I have the impression that the reason it invokes for not returning the right return type is moot.
I don't really know how this Visual Studio + TS compiler works but in the typescript project I'm working on, I just went and corrected it in my 'node_modules` folder directly and my editor started giving correct intellisense.

So I was wondering if you could just correct this.

If you want I can do a pull request.

Thanks!

Yea, a pull req would be nice. Probably it didn't compile on older versions of typescript/visual studio, I'm not sure.

thanks for this

Yeah no problem. Thank you :)

Do you know when you plan on releasing this?

Cheers!

published a new version to npm, containing some other misc changes.
sorry for the huge delay