Skip to content

Commit

Permalink
🚨 fix tsc error (umijs#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuitos committed Mar 1, 2021
1 parent f46d81b commit dfb59bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/sandbox/proxySandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getTargetValue, setCurrentRunningSandboxProxy } from './common';
* fastest(at most time) unique array method
* @see https://jsperf.com/array-filter-unique/30
*/
function uniq(array: PropertyKey[]) {
function uniq(array: Array<string | symbol>) {
return array.filter(function filter(this: PropertyKey[], element) {
return element in this ? false : ((this as any)[element] = true);
}, Object.create(null));
Expand Down Expand Up @@ -303,9 +303,8 @@ export default class ProxySandbox implements SandBox {
},

// trap to support iterator with sandbox
ownKeys(target: FakeWindow): PropertyKey[] {
const keys = uniq(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)));
return keys;
ownKeys(target: FakeWindow): ArrayLike<string | symbol> {
return uniq(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)));
},

defineProperty(target: Window, p: PropertyKey, attributes: PropertyDescriptor): boolean {
Expand Down

0 comments on commit dfb59bf

Please sign in to comment.