1+ /**
2+ * Declaration for https://github.com/s3u/JSONPath
3+ */
14declare module 'jsonpath-plus' {
25 type JSONPathCallback = ( payload : any , payloadType : any , fullPayload : any ) => any
36
4- type JSONPathOtherTypeCallback = ( ...args : Array < any > ) => void
7+ type JSONPathOtherTypeCallback = ( ...args : any [ ] ) => void
58
69 interface JSONPathOptions {
710 /**
811 * The JSONPath expression as a (normalized or unnormalized) string or array.
912 */
10- path : string | Array < any >
13+ path : string | any [ ]
1114 /**
1215 * The JSON object to evaluate (whether of null, boolean, number, string, object, or array type).
1316 */
14- json : null | boolean | number | string | object | Array < any >
17+ json : null | boolean | number | string | object | any [ ]
1518 /**
1619 * If this is supplied as false, one may call the evaluate method manually.
1720 *
@@ -99,10 +102,15 @@ declare module 'jsonpath-plus' {
99102 otherTypeCallback ?: undefined | JSONPathOtherTypeCallback
100103 }
101104
105+ interface JSONPathOptionsAutoStart extends JSONPathOptions {
106+ autostart : false
107+ }
108+
102109 interface JSONPathCallable {
103- ( options : JSONPathOptions ) : JSONPathClass
110+ < T = any > ( options : JSONPathOptionsAutoStart ) : JSONPathClass
111+ < T = any > ( options : JSONPathOptions ) : T
104112
105- ( path : JSONPathOptions [ 'path' ] , json : JSONPathOptions [ 'json' ] , callback : JSONPathOptions [ 'callback' ] , otherTypeCallback : JSONPathOptions [ 'otherTypeCallback' ] ) : JSONPathClass
113+ < T = any > ( path : JSONPathOptions [ 'path' ] , json : JSONPathOptions [ 'json' ] , callback : JSONPathOptions [ 'callback' ] , otherTypeCallback : JSONPathOptions [ 'otherTypeCallback' ] ) : T
106114 }
107115
108116 class JSONPathClass {
@@ -115,14 +123,14 @@ declare module 'jsonpath-plus' {
115123 * Accepts a normalized or unnormalized path as string and
116124 * converts to an array: for example, ['$', 'aProperty', 'anotherProperty'].
117125 */
118- static toPathArray ( path : string ) : Array < string >
126+ static toPathArray ( path : string ) : string [ ]
119127
120128 /**
121129 * Accepts a path array and converts to a normalized path string.
122130 * The string will be in a form like: $['aProperty']['anotherProperty][0].
123131 * The JSONPath terminal constructions ~ and ^ and type operators like @string() are silently stripped.
124132 */
125- static toPathString ( path : Array < string > ) : string
133+ static toPathString ( path : string [ ] ) : string
126134
127135 /**
128136 * Accepts a path array and converts to a JSON Pointer.
@@ -132,10 +140,7 @@ declare module 'jsonpath-plus' {
132140 *
133141 * The JSONPath terminal constructions ~ and ^ and type operators like @string() are silently stripped.
134142 */
135- static toPointer ( path : Array < string > ) : any
136-
137- constructor ( options : JSONPathOptions )
138- constructor ( path : JSONPathOptions [ 'path' ] , json : JSONPathOptions [ 'json' ] , callback : JSONPathOptions [ 'callback' ] , otherTypeCallback : JSONPathOptions [ 'otherTypeCallback' ] )
143+ static toPointer ( path : string [ ] ) : any
139144
140145 evaluate ( path : JSONPathOptions [ 'path' ] , json : JSONPathOptions [ 'json' ] , callback : JSONPathOptions [ 'callback' ] , otherTypeCallback : JSONPathOptions [ 'otherTypeCallback' ] )
141146 evaluate ( options : { path : JSONPathOptions [ 'path' ] , json : JSONPathOptions [ 'json' ] , callback : JSONPathOptions [ 'callback' ] , otherTypeCallback : JSONPathOptions [ 'otherTypeCallback' ] } )
0 commit comments