-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
3.4.0-rc - behaviour changed from 3.3 (regression?) #30489
Comments
This is caused by #29437 I think. Not sure I would class this as a regression: is it causing negative behaviour? |
At least for me :) , I use it like this type ExtendIfI1<T> = T extends I1<any> ? T & Something : T I can't use I think it boils down to the generic being inside the template part, this is type A<T> = T extends any ? T : never
type B = A<number> // this is any & number, which is number
type O<T> = T extends I<any> ? T : never
type B = O<I<number>>
// could this be changed so it generates I<any & number>, which is I<number>
// rather than I<any> & I<number> ? |
This is the intended behavior to improve inference elsewhere by "collapsing" conditional types into plain types when we detect that's possible. One option is to use type O<T> = T extends I<unknown> ? T : never This will produce the type You can also make the conditional non-distributive by writing type O<T> = [T] extends [I<unknown>] ? T : never |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
While the original behavior was intended, its interaction with |
I found a case where types yielded differ between 3.3 and 3.4, but I'm not sure if it is a regression or it is intended
The text was updated successfully, but these errors were encountered: