Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed typescript typing for sandbox #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/jsonpath.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<string, any>
sandbox?: {}
/**
* Whether or not to wrap the results in an array.
*
Expand Down Expand Up @@ -136,8 +136,8 @@ declare module 'jsonpath-plus' {
<T = any>(
path: JSONPathOptions['path'],
json: JSONPathOptions['json'],
callback: JSONPathOptions['callback'],
otherTypeCallback: JSONPathOptions['otherTypeCallback']
callback?: JSONPathOptions['callback'],
otherTypeCallback?: JSONPathOptions['otherTypeCallback']
): T
}

Expand Down Expand Up @@ -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;
}