export interface ConfigOptions { [ key ] : any ; } param template param override return export const merge = < T extends ConfigOptions > ( template , override ) : T => { let cleanOverride ; if ( override !== undefined ) { if ( typeof override !== 'object' ) { throw new Error ( 'merge expects override to be an object!' ) ; } else { cleanOverride = Object . keys ( override ) . reduce ( ( acc , key ) => { if ( override [ key ] !== undefined ) { acc [ key ] = override [ key ] ; } return acc ; } , { } ) ; } } return Object . assign ( { } , template , cleanOverride ) ; } ;