You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// extends can be used in two ways// one is a real extends// another is like a ternary expression with the traverse of T, called Distributive Conditional Types// second one can be used in a fun way, like Flatten// type Flatten<T> = T extends any[] ? T[number]: T;typeMyExclude<T,U>=TextendsU ? never : T// https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
The text was updated successfully, but these errors were encountered:
is it all the time applied only to first generic parameter?
Normally how extends keyword works, it distributes both operands. If you need to prevent distribution any of the operands, then use square brackets. For example- [T] extends U or T extends [U]. Also, [T] extends [U] won't distribute any of the operands.
The text was updated successfully, but these errors were encountered: