interface WebComponentClass { prototype: any; } /** Create properties on the web component that match the given React component props */ function defineComponentProperties(webComponentClass: WebComponentClass, propNames: string[], dropPropertyName: string = "_drop") { propNames.forEach((propName) => { Object.defineProperty(webComponentClass.prototype, `_${propName}`, { writable: true, value: undefined, }); Object.defineProperty(webComponentClass.prototype, propName, { get: function() { return this[`_${propName}`]; }, set: function(value) { this[`_${propName}`] = value; if (this[dropPropertyName]) this[dropPropertyName].render({ [propName]: value }); }, }); }); } export default defineComponentProperties;