diff --git a/express-handlebars/express-handlebars-tests.ts b/express-handlebars/express-handlebars-tests.ts new file mode 100644 index 000000000..3fa6ef31d --- /dev/null +++ b/express-handlebars/express-handlebars-tests.ts @@ -0,0 +1,17 @@ +/// +/// +/// + +import express = require('express'); +import exphbs = require('express-handlebars'); + +var app = express(); +var hbs: Exphbs = exphbs.create({defaultLayout: 'main'}); + +app.engine('handlebars', hbs.engine); +app.set('view engine', 'handlebars'); + +app.listen(1337); +console.log('Test Express Handlebars app on port 1337..'); +console.log('Done'); +process.exit(0); diff --git a/express-handlebars/express-handlebars.d.ts b/express-handlebars/express-handlebars.d.ts new file mode 100644 index 000000000..636bd5d79 --- /dev/null +++ b/express-handlebars/express-handlebars.d.ts @@ -0,0 +1,46 @@ +// Type definitions for express-handlebars +// Project: https://github.com/ericf/express-handlebars +// Definitions by: Sam Saint-Pettersen +// Definitions: https://github.com/borisyankov/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?: string; + defaultLayout?: string; + helpers?: any; + 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?: () => string): void; +} + +declare module "express-handlebars" { + var exphbs: Exphbs; + export = exphbs; +}