Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
fix: access to restricted properties
Browse files Browse the repository at this point in the history
To work around older browsers and strict mode issues we need to filter
some more properties for external components
  • Loading branch information
Markus Wolf committed Sep 6, 2017
1 parent e69e2e8 commit 9c9f75d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[*]
indent_style = space
indent_size = 2
insert_final_newline = true
8 changes: 7 additions & 1 deletion lib/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ export function External<TFunction extends Function>(...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;
Expand Down

0 comments on commit 9c9f75d

Please sign in to comment.