import type { APIMethodsMap } from './interfaces' import type { ConstructableType } from '../types/utils' export const extendComponent = ( klass: any, methods: APIMethodsMap ) => { Object.keys(methods).forEach((methodName) => { if (klass.prototype.hasOwnProperty(methodName)) { throw new Error(`[extendComponent] Duplicated method name: ${methodName}`) } }) Object.defineProperties(klass.prototype, methods) return klass as ConstructableType }