-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Constraints cannot be proven in mapped types combination #13039
Comments
ha! don't downvote me, downvote the design team who is making typescript is the only language out there that sacrifices correctness for "convenience" of use, this is blatant and unprecedented |
Guess what we're spending the swag budget on this year |
Repro with some thing renamed / simplified a little interface Thing { blah };
type B<C extends Thing> = { m: C };
type ThingMap<M> = {
[P in keyof M]: Thing;
};
type Failing<T, Cs extends ThingMap<T>> = {
foo: B<Cs[keyof T]>;
};
type Passing<T> = {
foo: B<ThingMap<T>[keyof T]>;
}; |
@RyanCavanaugh Seems like your repro is fixed now, but @Igorbek 's repro still throws an error. |
|
should be fixed in latest. |
TypeScript Version: 2.1.4 / nightly (2.2.0-dev.20161219)
Code
Expected behavior:
No errors, the constraint has been proven
Actual behavior:
Error in
Failing
type atB<Ts[P], Cs[P]>
: Type 'Cs[P]' does not satisfy the constraint 'A<Ts[P]>'.Note
If I change
A<T>
to be justT
(type A<T> = T;
), all compiles just fine.The text was updated successfully, but these errors were encountered: