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
//使用ts实现exclude方法 type MyExclude<T, U> = T extends U ? never : T; type eg = MyExclude<string | number | boolean, number | boolean>;
The text was updated successfully, but these errors were encountered:
//extends前面T是泛型会进行分发 type MyExclude<T, V> = T extends V ? never : T; //相当于 ('a' extends 'a'|'c' ? never : 'a') | ('b' extends 'a'|'c' ? never : 'b') //普通字面量不会进行分发 'a'|'b' extends 'a'|'c' ? 1 : 2 //2 type a = MyExclude<"a" | "b", "a" | "c">;
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: