type Keys < T > = ( keyof T ) [ ] ; interface OmitFunction { < T , K extends Keys < T > > ( obj , keys ) : { [ K2 in Exclude < keyof T , K [ number ] > ] : T [ K2 ] ; } ; } export const omit = ( obj , keys ) => { const ret = { } as { [ K in keyof typeof obj ] : typeof obj [ K ] ; } ; let key ; for ( key in obj ) { if ( ! keys . includes ( key ) ) { ret [ key ] = obj [ key ] ; } } return ret ; } ;