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 Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
不使用 exclude 并实现其效果
exclude
type MyExclude<T, U> = T extends U ? never : T
exclude的作用就是,排除U类型后,T剩下的类型,所以刚好使用 extends 做条件判断
extends
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题
不使用
exclude
并实现其效果答案
讲解
exclude
的作用就是,排除U类型后,T剩下的类型,所以刚好使用extends
做条件判断The text was updated successfully, but these errors were encountered: