Skip to content

Commit 10a743c

Browse files
Update jsonata.d.ts
1 parent e32efd8 commit 10a743c

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

jsonata.d.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
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

55
declare function jsonata(str: string): jsonata.Expression;
66
declare 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

Comments
 (0)