From 9c9f75d482acfbb7bb6b26046d8b9872e511af20 Mon Sep 17 00:00:00 2001 From: Markus Wolf Date: Wed, 6 Sep 2017 10:06:12 +0200 Subject: [PATCH] fix: access to restricted properties To work around older browsers and strict mode issues we need to filter some more properties for external components --- .editorconfig | 1 + lib/external.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 76a93c06..4a8457ba 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,4 @@ [*] indent_style = space indent_size = 2 +insert_final_newline = true \ No newline at end of file diff --git a/lib/external.ts b/lib/external.ts index 9efb9c7d..f3688b69 100644 --- a/lib/external.ts +++ b/lib/external.ts @@ -14,7 +14,13 @@ export function External(...args: any[]): ClassDecor }; (constructor as any).displayName = (target as any).name; Object.getOwnPropertyNames(target) - .filter(prop => !(constructor as any)[prop] && prop !== 'name' && prop !== 'length') + .filter(prop => + prop !== 'name' && + prop !== 'length' && + prop !== 'caller' && + prop !== 'callee' && + prop !== 'arguments' && + !(constructor as any)[prop]) .forEach(prop => (constructor as any)[prop] = (target as any)[prop]); constructor.prototype = target.prototype; return constructor as any;