I think I have noticed a problem with Generic Methods, not properly inferring their types, when they are used as a value, instead of as a method. I'm not sure if it's a known issue or not.
It's easy enough to work around by using a function, but I'd prefer to just hand in the method, since it's already a method that can be called.
This case is in Rx, but I've seen other examples of it too.
var observableOfAny = Observable.from(items)
.flatMap(Observable.from); // using as a variable doesn't work
var observableOfString = Observable.from(items)
.flatMap(x => Observable.from(x)); // Using a delegate works
var fromString: (arr: string[]) => Observable<string> = Observable.from;
var observableOfString = Observable.from(items)
.flatMap(fromString); // Properly casting the method works
I've got an example, again using rx interfaces (so maybe something is wrong with them? it's possible). playground example
I think I have noticed a problem with Generic Methods, not properly inferring their types, when they are used as a value, instead of as a method. I'm not sure if it's a known issue or not.
It's easy enough to work around by using a function, but I'd prefer to just hand in the method, since it's already a method that can be called.
This case is in Rx, but I've seen other examples of it too.
I've got an example, again using rx interfaces (so maybe something is wrong with them? it's possible). playground example