|
3 | 3 | */ |
4 | 4 | declare module 'jsonpath-plus' { |
5 | 5 | type JSONPathCallback = ( |
6 | | - payload: any, payloadType: any, fullPayload: any |
7 | | - ) => any |
| 6 | + payload: any, payloadType: "value"|"property", fullPayload: any |
| 7 | + ) => void |
8 | 8 |
|
9 | | - type JSONPathOtherTypeCallback = (...args: any[]) => void |
| 9 | + type JSONPathOtherTypeCallback = (...args: any[]) => boolean |
| 10 | + |
| 11 | + type JSON = null|boolean|number|string|{[key: string]: JSON}|JSON[] |
10 | 12 |
|
11 | 13 | interface JSONPathOptions { |
12 | 14 | /** |
13 | 15 | * The JSONPath expression as a (normalized or unnormalized) string or |
14 | 16 | * array. |
15 | 17 | */ |
16 | | - path: string | any[] |
| 18 | + path: string | string[] |
17 | 19 | /** |
18 | 20 | * The JSON object to evaluate (whether of null, boolean, number, |
19 | 21 | * string, object, or array type). |
20 | 22 | */ |
21 | | - json: null | boolean | number | string | object | any[] |
| 23 | + json: JSON|any |
22 | 24 | /** |
23 | 25 | * If this is supplied as false, one may call the evaluate method |
24 | 26 | * manually. |
@@ -54,7 +56,7 @@ declare module 'jsonpath-plus' { |
54 | 56 | * (Note that the current path and value will also be available to those |
55 | 57 | * expressions; see the Syntax section for details.) |
56 | 58 | */ |
57 | | - sandbox?: Map<string, any> |
| 59 | + sandbox?: {} |
58 | 60 | /** |
59 | 61 | * Whether or not to wrap the results in an array. |
60 | 62 | * |
@@ -95,7 +97,7 @@ declare module 'jsonpath-plus' { |
95 | 97 | * |
96 | 98 | * @default null |
97 | 99 | */ |
98 | | - parentProperty?: null | any |
| 100 | + parentProperty?: null | string |
99 | 101 | /** |
100 | 102 | * If supplied, a callback will be called immediately upon retrieval of |
101 | 103 | * an end point value. |
@@ -146,7 +148,9 @@ declare module 'jsonpath-plus' { |
146 | 148 | * Exposes the cache object for those who wish to preserve and reuse |
147 | 149 | * it for optimization purposes. |
148 | 150 | */ |
149 | | - static cache: any |
| 151 | + static cache: { |
| 152 | + [key: string]: string[] |
| 153 | + } |
150 | 154 |
|
151 | 155 | /** |
152 | 156 | * Accepts a normalized or unnormalized path as string and |
@@ -174,7 +178,7 @@ declare module 'jsonpath-plus' { |
174 | 178 | * The JSONPath terminal constructions `~` and `^` and type operators |
175 | 179 | * like `@string()` are silently stripped. |
176 | 180 | */ |
177 | | - static toPointer(path: string[]): any |
| 181 | + static toPointer(path: string[]): string |
178 | 182 |
|
179 | 183 | evaluate( |
180 | 184 | path: JSONPathOptions['path'], |
|
0 commit comments