Reputation: 7338
Here is my goal, I'm wondering is it possible to create a PickFromArray
type like this?
type FooBar = { foo: string, bar: number, foobar: string }
type Result = PickFromArray<FooBar,['foo','foobar']> // {foo: string, foobar: string}
Upvotes: 1
Views: 51
Reputation: 7338
Solved.
type PickFromArray<T,U extends any[]> = Pick<T, U[number]>
Upvotes: 1