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
首先Omit<A, B>可以理解为Pick<A, C>,其中B | C exends keyof A。例如A = {a:1, b: 2, c: 3, d: 4} B = 'a'|'b' 那么C = 'c'|'d'
type MyOmit<A, B extends keyof A> = type Pick<A, Exclude<keyof A, B>>
Pick和Exclude也可以自定义实现
type MyPick<A, B extends keyof A> = {[K in B]: A[K]}
type MyExclude<A, B> = A extends B ? never : A
// 你的答案
The text was updated successfully, but these errors were encountered:
首先Omit<A, B>可以理解为Pick<A, C>,其中B | C exends keyof A。例如A = {a:1, b: 2, c: 3, d: 4} B = 'a'|'b' 那么C = 'c'|'d'
type MyOmit<A, B extends keyof A> = type Pick<A, Exclude<keyof A, B>>
Pick和Exclude也可以自定义实现
type MyPick<A, B extends keyof A> = {[K in B]: A[K]}
type MyExclude<A, B> = A extends B ? never : A
// 你的答案
The text was updated successfully, but these errors were encountered: