-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Update RxJS in user test suite #33125
Comments
@benlesh got any details you can share on what went wrong? |
I'm currently trying to update master to 3.6.2, and just running into interesting new typing issues. Probably a dozen or so in total. Most of them are probably a correctness thing, I'm sure. You can try it though:
:) I'm not complaining, but I swear that 90% of RxJS work is just updating typings and dealing with the fallout of type updates, new inference patterns, and changes to strictness. :) It's just the job now, I guess. haha |
Some of it seems to stem from some interesting trickery we're doing to type things like Prior to doing some trickery (a while ago) with conditional types, this didn't work: import { of } from 'rxjs';
import { switchMap } from 'rxjs';
of(Math.random()).pipe(switchMap(n => n > 0.5 ? of('test') : of(123))) // $ExpectType Observable<string | number> See |
I think the Rx in our user suite is just the published |
Yeah, there's some incompatibility with
Updating to the latest version of |
We just tried to upgrade unsplash.com from TS 3.5.2 to 3.6.2 and ran into 2 regressions, which I've filed:
I'd really love for Unsplash to be part of the TS user test suite as well, so we don't have to find these issues ourselves each time we try to upgrade (as we have been doing). |
Related: #33131 |
It looks like the biggest problems right now are failures around a solution we were using to get types to infer properly from some of our functions. Here you can find a minimal reproduction of what we were doing Basically this: /** Problem */
function toIterator<T>(iterable: Iterable<T>): Iterator<T> {
return iterable[Symbol.iterator]();
}
const a = toIterator('test');
const b = toIterator([1, 2, 3]);
const c = toIterator(Math.random() ? 'test' : [1, 2, 3]); // ERROR HERE
/** Solution */
type IteratedValueOf<I> = I extends Iterable<infer T> ? T : never;
function toIteratorFixed<T extends Iterable<any>>(iterable: T): Iterator<IteratedValueOf<T>> {
return iterable[Symbol.iterator]();
}
const d = toIteratorFixed('test');
const e = toIteratorFixed([1, 2, 3]);
const f = toIteratorFixed(Math.random() ? 'test' : [1, 2, 3]); // FIXED HERE |
cc @ahejlsberg the above example is connected with the union type matching behavior we added into inference. |
Sounds like something slipped by us this release.
https://twitter.com/BenLesh/status/1166838448688381953
The text was updated successfully, but these errors were encountered: