forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
express-handlebars.d.ts
49 lines (43 loc) · 1.43 KB
/
express-handlebars.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Type definitions for express-handlebars
// Project: https://github.com/ericf/express-handlebars
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>, Igor Dultsev <https://github.com/yhaskell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface PartialTemplateOptions {
cache?: boolean;
precompiled?: boolean;
}
interface RenderOptions {
cache?: boolean;
data?: Object;
helpers?: any;
partials?: any;
}
interface ExphbsOptions {
handlebars?: any;
extname?: string;
layoutsDir?: string;
partialsDir?: any;
defaultLayout?: string;
helpers?: any;
compilerOptions?: any;
}
interface Exphbs {
engine: Function;
extname: string;
compiled: Object;
precompiled: Object;
create(options?: ExphbsOptions): Exphbs;
getPartials(options?: PartialTemplateOptions): Promise<Object>;
getTemplate(filePath: string, options?: PartialTemplateOptions): Promise<Function>;
getTemplates(dirPath: string, options?: PartialTemplateOptions): Promise<Object>;
render(filePath: string, context: Object, options?: RenderOptions): Promise<string>;
renderView(viewPath: string, optionsOrCallback: any, callback?: () => string): void;
}
interface ExpressHandlebars {
(options?: ExphbsOptions): Function;
create (options?: ExphbsOptions): Exphbs;
}
declare module "express-handlebars" {
var exphbs: ExpressHandlebars;
export = exphbs;
}