diff --git a/packages/global-registrator/src/GlobalRegistrator.ts b/packages/global-registrator/src/GlobalRegistrator.ts index db03c78c7..0a0c2329d 100644 --- a/packages/global-registrator/src/GlobalRegistrator.ts +++ b/packages/global-registrator/src/GlobalRegistrator.ts @@ -25,7 +25,11 @@ export default class GlobalRegistrator { if (global[key] !== window[key] && !IGNORE_LIST.includes(key)) { this.registered[key] = global[key] !== window[key] && global[key] !== undefined ? global[key] : null; - global[key] = typeof window[key] === 'function' ? window[key].bind(global) : window[key]; + + // Only bind functions that aren't used as classes, since bound functions can't be extended. + const bind = typeof window[key] === 'function' && !isClassLikeName(key); + + global[key] = bind ? window[key].bind(global) : window[key]; } } @@ -56,3 +60,7 @@ export default class GlobalRegistrator { this.registered = null; } } + +function isClassLikeName(name: string): boolean { + return name[0] === name[0].toUpperCase(); +}