-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enumerable.SelectMany declaration needs an overload without "result" parameter. #46
Comments
Do you want to send a pull request? |
Yes, in a few hours. |
One question before I do that though: is there a specific reason for |
Ah, I see now: it's being stubbed with identify function at the facade level. Never mind then. |
Although, come to think of it, omitting |
If these are not optional you will not be able to do this: var jsn = [
[11, 21, 31],
[12, 22, 32],
[13, 23, 33],
[14, 24, 34]
];
for (let num of Linq(jsn).SelectMany()) {
Console.log(num);
} |
Right, But hover on |
I can't right now. Writing from my phone :) |
Well, I'll tell you then: I don't think this can be fixed though. |
What if you explicitly specify it like this:
|
It's not But yes, you can explicitly specify it like this:
But you have to remember to do that, it would be a great pain in the butt, and it won't be the immediately obvious solution when you encounter the errors stemming from the type being Actually, now that I think about it, if I was designing the API, I would sacrifice brevity and some efficiency for clarity and reliability, and would have made
|
I agree but it would not be worth it to break interface |
Right now
SelectMany
is declared like this:The second parameter,
result
, is optional, but it's also the only one that would allow for inferringV
. As a result, when the second parameter is omitted,V
cannot be inferred and ends up as{}
. For example:The type of
xs
will be inferred asEnumerable<{}>
.To fix this, an overload of
SelectMany
with one generic parameter needs to be explicitly present, and in order to make it distinct from the first overload, theresult
parameter needs to be made not optional, which would also mean thatselector
can't be optional either:P.S. I also don't quite get why
selector
was declared optional in the first place.The text was updated successfully, but these errors were encountered: