1 | declare type HookKey = keyof ProxyHandler<any>;
|
2 | declare type HookMap = {
|
3 | [hook in HookKey]?: (p: PropertyKey[], ...args: any[]) => ReturnType<Required<ProxyHandler<any>>[hook]>;
|
4 | };
|
5 | declare class DeepProxy<T extends object = any> {
|
6 | private readonly _paths;
|
7 | protected _root: T;
|
8 | private readonly _handler;
|
9 | readonly proxy: T;
|
10 | constructor(root?: T);
|
11 | protected addPath(path: PropertyKey[], proto: object | null): any;
|
12 | getByPath(path: PropertyKey[]): any;
|
13 | /** Always configurable to comply with:
|
14 | * > A property cannot be reported as non-configurable, if it does not exists as an own property of the target object or if it exists as a configurable own property of the target object.
|
15 | * > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/getOwnPropertyDescriptor (Invariants)
|
16 | * */
|
17 | getOwnPropertyDescriptor(path: PropertyKey[], prop: PropertyKey): PropertyDescriptor | undefined;
|
18 | get(path: PropertyKey[], prop: PropertyKey): any;
|
19 | }
|
20 | /** Extends the defined DeepProxy by adding all other possible hooks */
|
21 | interface DeepProxy extends Required<HookMap> {
|
22 | }
|
23 | export default DeepProxy;
|