1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | declare var Handlebars: HandlebarsStatic;
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | interface HandlebarsTemplatable {
|
15 | template: HandlebarsTemplateDelegate;
|
16 | }
|
17 |
|
18 | interface HandlebarsTemplateDelegate {
|
19 | (context: any, options?: any): string;
|
20 | }
|
21 |
|
22 | interface HandlebarsCommon {
|
23 | registerHelper(name: string, fn: Function, inverse?: boolean): void;
|
24 | registerPartial(name: string, str: any): void;
|
25 | K(): void;
|
26 | createFrame(object: any): any;
|
27 |
|
28 | Exception(message: string): void;
|
29 | SafeString: typeof hbs.SafeString;
|
30 | Utils: typeof hbs.Utils;
|
31 |
|
32 | logger: Logger;
|
33 | log(level: number, obj: any): void;
|
34 | }
|
35 |
|
36 | interface HandlebarsStatic extends HandlebarsCommon {
|
37 | parse(input: string): hbs.AST.ProgramNode;
|
38 | compile(input: any, options?: any): HandlebarsTemplateDelegate;
|
39 | }
|
40 |
|
41 | interface HandlebarsTemplates {
|
42 | [index: string]: HandlebarsTemplateDelegate;
|
43 | }
|
44 |
|
45 | interface HandlebarsRuntimeStatic extends HandlebarsCommon {
|
46 |
|
47 | templates: HandlebarsTemplates;
|
48 | }
|
49 |
|
50 | declare namespace hbs {
|
51 | class SafeString {
|
52 | constructor(str: string);
|
53 | static toString(): string;
|
54 | }
|
55 |
|
56 | namespace Utils {
|
57 | function escapeExpression(str: string): string;
|
58 | }
|
59 | }
|
60 |
|
61 | interface Logger {
|
62 | DEBUG: number;
|
63 | INFO: number;
|
64 | WARN: number;
|
65 | ERROR: number;
|
66 | level: number;
|
67 |
|
68 | methodMap: { [level: number]: string };
|
69 |
|
70 | log(level: number, obj: string): void;
|
71 | }
|
72 |
|
73 | declare namespace hbs {
|
74 | namespace AST {
|
75 | interface IStripInfo {
|
76 | left?: boolean;
|
77 | right?: boolean;
|
78 | inlineStandalone?: boolean;
|
79 | }
|
80 |
|
81 | class NodeBase {
|
82 | firstColumn: number;
|
83 | firstLine: number;
|
84 | lastColumn: number;
|
85 | lastLine: number;
|
86 | type: string;
|
87 | }
|
88 |
|
89 | class ProgramNode extends NodeBase {
|
90 | statements: NodeBase[];
|
91 | }
|
92 |
|
93 | class IdNode extends NodeBase {
|
94 | original: string;
|
95 | parts: string[];
|
96 | string: string;
|
97 | depth: number;
|
98 | idName: string;
|
99 | isSimple: boolean;
|
100 | stringModeValue: string;
|
101 | }
|
102 |
|
103 | class HashNode extends NodeBase {
|
104 | pairs: {0: string;
|
105 | 1: NodeBase}[];
|
106 | }
|
107 |
|
108 | class SexprNode extends NodeBase {
|
109 | hash: HashNode;
|
110 | id: NodeBase;
|
111 | params: NodeBase[];
|
112 | isHelper: boolean;
|
113 | eligibleHelper: boolean;
|
114 | }
|
115 |
|
116 | class MustacheNode extends NodeBase {
|
117 | strip: IStripInfo;
|
118 | escaped: boolean;
|
119 | sexpr: SexprNode;
|
120 |
|
121 | }
|
122 |
|
123 | class BlockNode extends NodeBase {
|
124 | mustache: MustacheNode;
|
125 | program: ProgramNode;
|
126 | inverse: ProgramNode;
|
127 | strip: IStripInfo;
|
128 | isInverse: boolean;
|
129 | }
|
130 |
|
131 | class PartialNameNode extends NodeBase {
|
132 | name: string;
|
133 | }
|
134 |
|
135 | class PartialNode extends NodeBase {
|
136 | partialName: PartialNameNode;
|
137 | context: NodeBase;
|
138 | hash: HashNode;
|
139 | strip: IStripInfo;
|
140 | }
|
141 |
|
142 | class RawBlockNode extends NodeBase {
|
143 | mustache: MustacheNode;
|
144 | program: ProgramNode;
|
145 | }
|
146 |
|
147 | class ContentNode extends NodeBase {
|
148 | original: string;
|
149 | string: string;
|
150 | }
|
151 |
|
152 | class DataNode extends NodeBase {
|
153 | id: IdNode;
|
154 | stringModeValue: string;
|
155 | idName: string;
|
156 | }
|
157 |
|
158 | class StringNode extends NodeBase {
|
159 | original: string;
|
160 | string: string;
|
161 | stringModeValue: string;
|
162 | }
|
163 |
|
164 | class NumberNode extends NodeBase {
|
165 | original: string;
|
166 | number: string;
|
167 | stringModeValue: number;
|
168 | }
|
169 |
|
170 | class BooleanNode extends NodeBase {
|
171 | bool: string;
|
172 | stringModeValue: boolean;
|
173 | }
|
174 |
|
175 | class CommentNode extends NodeBase {
|
176 | comment: string;
|
177 | strip: IStripInfo;
|
178 | }
|
179 | }
|
180 | }
|
181 |
|
182 | declare module "handlebars" {
|
183 | export = Handlebars;
|
184 | }
|