DeepPick
Implement a type DeepPick, that extends Utility types Pick
.
A type takes two arguments.
For example:
type obj = {
name: 'hoge',
age: 20,
friend: {
name: 'fuga',
age: 30,
family: {
name: 'baz',
age: 1
}
}
}
type T1 = DeepPick<obj, 'name'> // { name : 'hoge' }
type T2 = DeepPick<obj, 'name' | 'friend.name'> // { name : 'hoge' } & { friend: { name: 'fuga' }}
type T3 = DeepPick<obj, 'name' | 'friend.name' | 'friend.family.name'> // { name : 'hoge' } & { friend: { name: 'fuga' }} & { friend: { family: { name: 'baz' }}}