diff --git a/express-handlebars/express-handlebars.d.ts b/express-handlebars/express-handlebars.d.ts index ee5d78436..6e11635b5 100644 --- a/express-handlebars/express-handlebars.d.ts +++ b/express-handlebars/express-handlebars.d.ts @@ -3,6 +3,20 @@ // Definitions by: Sam Saint-Pettersen // Definitions: https://github.com/borisyankov/DefinitelyTyped +interface Promise {} // This should be replaced with a Promise type definition import. + +interface PartialTemplateOptions { + cache?: boolean; + precompiled?: boolean; +} + +interface RenderOptions { + cache?: boolean; + data?: Object; + helpers?: any; + partials?: any; +} + interface ExphbsOptions { handlebars?: any; extname?: string; @@ -13,7 +27,20 @@ interface ExphbsOptions { compilerOptions?: any; } +interface Exphbs { + engine: Function; + extname: string; + compiled: Object; + precompiled: Object; + create(options?: ExphbsOptions): Exphbs; + getPartials(options?: PartialTemplateOptions): Promise; + getTemplate(filePath: string, options?: PartialTemplateOptions): Promise; + getTemplates(dirPath: string, options?: PartialTemplateOptions): Promise; + render(filePath: string, context: Object, options?: RenderOptions): Promise; + renderView(viewPath: string, optionsOrCallback?: any, callback?: Function): void; +} + declare module "express-handlebars" { - function exphbs(options: ExphbsOptions): Function; + var exphbs: Exphbs; export = exphbs; }