1- // Type definitions for jsonata 1.4
1+ // Type definitions for jsonata 1.7
22// Project: https://github.com/jsonata-js/jsonata
33// Definitions by: Nick <https://github.com/nick121212> and Michael M. Tiller <https://github.com/xogeny>
44
55declare function jsonata ( str : string ) : jsonata . Expression ;
66declare namespace jsonata {
7+
78 interface ExprNode {
8- type : string ;
9- value : any ;
10- position : number ;
9+ type : string ;
10+ value : any ;
11+ position : number ;
12+ }
13+
14+ interface JsonataError extends Error {
15+ code : string ;
16+ position : number ;
17+ token : string ;
18+ }
19+
20+ interface Environment {
21+ bind ( name : string , value : any ) : void ;
22+ lookup ( name : string ) : any ;
23+ readonly timestamp : Date ;
24+ readonly async : boolean ;
25+ }
26+
27+ interface Focus {
28+ readonly environment : Environment ;
29+ readonly input : any ;
1130 }
1231 interface Expression {
13- evaluate ( input : any , bindings ?: { [ name : string ] : any } , callback ?: ( err : Error , resp : any ) => void ) : any ;
32+ evaluate ( input : any , bindings ?: Record < string , any > ) : any ;
33+ evaluate ( input : any , bindings : Record < string , any > | undefined , callback : ( err : JsonataError , resp : any ) => void ) : void ;
1434 assign ( name : string , value : any ) : void ;
15- registerFunction ( name : string , f : Function , signature ?: string ) : void ;
35+ registerFunction ( name : string , implementation : ( this : Focus , ... args : any [ ] ) => any , signature ?: string ) : void ;
1636 ast ( ) : ExprNode ;
1737 }
1838}
1939
20- export = jsonata ;
40+ export = jsonata ;
0 commit comments