🚨 fix tsc error (#1292)
This commit is contained in:
parent
c79907d4c2
commit
0f3c195b4c
|
|
@ -12,7 +12,7 @@ import { getTargetValue, setCurrentRunningSandboxProxy } from './common';
|
||||||
* fastest(at most time) unique array method
|
* fastest(at most time) unique array method
|
||||||
* @see https://jsperf.com/array-filter-unique/30
|
* @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 array.filter(function filter(this: PropertyKey[], element) {
|
||||||
return element in this ? false : ((this as any)[element] = true);
|
return element in this ? false : ((this as any)[element] = true);
|
||||||
}, Object.create(null));
|
}, Object.create(null));
|
||||||
|
|
@ -303,9 +303,8 @@ export default class ProxySandbox implements SandBox {
|
||||||
},
|
},
|
||||||
|
|
||||||
// trap to support iterator with sandbox
|
// trap to support iterator with sandbox
|
||||||
ownKeys(target: FakeWindow): PropertyKey[] {
|
ownKeys(target: FakeWindow): ArrayLike<string | symbol> {
|
||||||
const keys = uniq(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)));
|
return uniq(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)));
|
||||||
return keys;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
defineProperty(target: Window, p: PropertyKey, attributes: PropertyDescriptor): boolean {
|
defineProperty(target: Window, p: PropertyKey, attributes: PropertyDescriptor): boolean {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user