TypeScript类型挑战 - implement Diff<A, B>
Implement DiffKeys<A, B> to return the keys either in A or B, but not in both.
题目出处:https://bigfrontend.dev/zh/typescript/implement-Diff-A-B
type A = DiffKeys<{a: 1, b: 2}, {b: 1, c: 2}> // 'a' | 'c'
1.实现思路分析
获取对象类型的keys,可以通过keyof 操作符去实现。
用数学集合的角度去...
blog.ai-is-luv.com1 min read