This project is read-only.

Wrong type with Generics and anonymous types, bug?

Topics: General
Aug 10, 2013 at 8:24 PM
Edited Aug 10, 2013 at 8:26 PM
I have a project called TSLinq

On TypeScript 0.9 somethings worked because it gave me the type any.

Now on version 0.9.1 I am trying to set correct types, but I came across this problem:
var joinedSimple = [1].AsLinq().Join([1], o => o, i => i, (o, i) => { return { Outter: o, Inner: i } });
The above code will give me the type Linq<{ Outter, Inner }>, which is what I expect. Then I am trying to retrieve the first element of the collection using
Which will simply get the value at index 0 on an internal array of type T. But instead of Linq<{ Outter, Inner }>, it is returning the type Linq<{}>.

Why is it not getting the correct type? Is it a bug?

The full code is on the Github link, Linq.ts is the lib and Linq.test.ts at Join method is the test which is failing.
Aug 12, 2013 at 3:35 PM
We've been tracking down a few generics bugs that crept in 0.9.1, specifically around linq-like patterns. This might be one of those. Moving to a work item so we can investigate.
Aug 12, 2013 at 3:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.