mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
Merge pull request #6393 from stpettersens/master
Type definitions and tests for express-handlebars
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="express-handlebars.d.ts" />
|
||||
|
||||
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);
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for express-handlebars
|
||||
// Project: https://github.com/ericf/express-handlebars
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
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<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;
|
||||
}
|
||||
|
||||
declare module "express-handlebars" {
|
||||
var exphbs: Exphbs;
|
||||
export = exphbs;
|
||||
}
|
||||
Reference in New Issue
Block a user