private param { object } baseObject param { object } methodsObject export default function enhanceWithMethods < B extends Record < string , unknown > , M extends Record < string , Function > > ( baseObject , methodsObject ) { return Object . keys ( methodsObject ) . reduce ( ( enhancedObject , methodName ) => { Object . defineProperty ( enhancedObject , methodName , { enumerable : false , configurable : true , writable : false , value : methodsObject [ methodName ] , } ) ; return enhancedObject ; } , baseObject ) ; }