From d5ac2e924f7340d7ba82130a9f92f18095021d9b Mon Sep 17 00:00:00 2001 From: Joep Joosten Date: Tue, 14 Jan 2020 08:13:08 +0100 Subject: [PATCH 1/2] Fixed typescript typing for sandbox --- src/jsonpath.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsonpath.d.ts b/src/jsonpath.d.ts index dff2290..4a34415 100644 --- a/src/jsonpath.d.ts +++ b/src/jsonpath.d.ts @@ -54,7 +54,7 @@ declare module 'jsonpath-plus' { * (Note that the current path and value will also be available to those * expressions; see the Syntax section for details.) */ - sandbox?: Map + sandbox?: {} /** * Whether or not to wrap the results in an array. * From c20c3a40dcf45e2715f6cffeeb7362634759143c Mon Sep 17 00:00:00 2001 From: Joep Joosten Date: Tue, 14 Jan 2020 15:36:14 +0100 Subject: [PATCH 2/2] Fixed other issues when trying to compile test-api.js with typescript --- src/jsonpath.d.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/jsonpath.d.ts b/src/jsonpath.d.ts index 4a34415..bf882a4 100644 --- a/src/jsonpath.d.ts +++ b/src/jsonpath.d.ts @@ -13,12 +13,12 @@ declare module 'jsonpath-plus' { * The JSONPath expression as a (normalized or unnormalized) string or * array. */ - path: string | any[] + path?: string | any[] /** * The JSON object to evaluate (whether of null, boolean, number, * string, object, or array type). */ - json: null | boolean | number | string | object | any[] + json?: null | boolean | number | string | object | any[] /** * If this is supplied as false, one may call the evaluate method * manually. @@ -136,8 +136,8 @@ declare module 'jsonpath-plus' { ( path: JSONPathOptions['path'], json: JSONPathOptions['json'], - callback: JSONPathOptions['callback'], - otherTypeCallback: JSONPathOptions['otherTypeCallback'] + callback?: JSONPathOptions['callback'], + otherTypeCallback?: JSONPathOptions['otherTypeCallback'] ): T } @@ -182,15 +182,9 @@ declare module 'jsonpath-plus' { callback: JSONPathOptions['callback'], otherTypeCallback: JSONPathOptions['otherTypeCallback'] ): any - evaluate(options: { - path: JSONPathOptions['path'], - json: JSONPathOptions['json'], - callback: JSONPathOptions['callback'], - otherTypeCallback: JSONPathOptions['otherTypeCallback'] - }): any + evaluate(options?: JSONPathOptions): any } type JSONPathType = JSONPathCallable & JSONPathClass - - export const JSONPath: JSONPathType + export const JSONPath: JSONPathType; }