We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type IsAny<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false
type IsNever<A, B> = [T] extends [never] ? true : false
type TestAny<T> = T extends number ? 1 : 2;
type IsTuple<T> = T extends [...params: infer Eles] ? NotEqual<Eles['length'], number> : false type NotEqual<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? false : true
The text was updated successfully, but these errors were encountered:
No branches or pull requests
如果是两个条件类型 T1 extends U1 ? X1 : Y1 和 T2 extends U2 ? X2 : Y2 相关的话,那 T1 和 T2 相关、X1 和 X2 相关、Y1 和 Y2 相关,而 U1 和 U2 相等。
never 在条件类型中也比较特殊,如果条件类型左边是类型参数,并且传入的是 never,那么直接返回 never, 直接去判断的话就会出现这样的问题,使用数组包一下可以避免
any 在条件类型中也比较特殊,如果类型参数为 any,会直接返回 trueType 和 falseType 的合并:
元组类型的 length 是数字字面量,而数组的 length 是 number。
The text was updated successfully, but these errors were encountered: