export const pick = < Source , Key extends keyof Source > ( source , keys ) : Pick < Source , Key > => { let result = { } ; let index = - 1 ; const length = Object . keys ( source ) . length ; if ( typeof keys === "string" ) { result = { [ keys ] : source [ keys ] } ; return result ; } while ( ++ index < length ) { let key = ( keys as Key [ ] ) [ index ] ; result [ key ] = source [ key ] ; } return result ; } ;