/** * A shallow copy of `source` holding only `keys`, in the order they are given. * The copy is only as complete as `source`: a key it lacks lands as undefined. */ export function pick( source: T, keys: readonly K[], ): Pick { const picked = {} as Pick; for (const key of keys) { picked[key] = source[key]; } return picked; }