diff --git a/harmony-proxy/harmony-proxy.d.ts b/harmony-proxy/harmony-proxy.d.ts new file mode 100644 index 000000000..c3893201b --- /dev/null +++ b/harmony-proxy/harmony-proxy.d.ts @@ -0,0 +1,37 @@ +// Type definitions for harmony-proxy 1.0.0 +// Project: https://www.npmjs.com/package/harmony-proxy +// Definitions by: Remo Jansen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module harmonyProxy { + type PropertyKey = string | number | symbol; + + interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; + } + + interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T + } +} + +declare let Proxy: harmonyProxy.ProxyConstructor; + +declare module "harmony-proxy" { + let _Proxy: harmonyProxy.ProxyConstructor; + export = _Proxy; +}