mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 21:40:21 +00:00
Merge pull request #34534 from chrisgedrim/fix-express-handlebars
Correct callback signature for express-handlebars renderView
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
import express = require('express');
|
||||
import exphbs = require('express-handlebars');
|
||||
import assert = require('assert');
|
||||
|
||||
var app = express();
|
||||
|
||||
app.engine('handlebars', exphbs({defaultLayout: 'main'}));
|
||||
app.set('view engine', 'handlebars');
|
||||
|
||||
const hbs = exphbs.create({defaultLayout: 'main'});
|
||||
|
||||
hbs.renderView('test', (err: any) => {});
|
||||
hbs.renderView('test', (err: any, content: string) => {});
|
||||
hbs.renderView('test', {
|
||||
layout: 'main'
|
||||
}, (err: any) => {});
|
||||
hbs.renderView('test', {
|
||||
layout: 'main'
|
||||
}, (err: any, content: string) => {});
|
||||
|
||||
app.listen(1337);
|
||||
console.log('Test Express Handlebars app on port 1337..');
|
||||
console.log('Done');
|
||||
|
||||
Vendored
+6
-1
@@ -26,6 +26,10 @@ interface ExphbsOptions {
|
||||
compilerOptions?: any;
|
||||
}
|
||||
|
||||
interface ExphbsCallback {
|
||||
(err: any, content?: string): void;
|
||||
}
|
||||
|
||||
interface Exphbs {
|
||||
engine: Function;
|
||||
extname: string;
|
||||
@@ -36,7 +40,8 @@ interface Exphbs {
|
||||
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;
|
||||
renderView(viewPath: string, callback: ExphbsCallback): void;
|
||||
renderView(viewPath: string, options: any, callback: ExphbsCallback): void;
|
||||
}
|
||||
|
||||
interface ExpressHandlebars {
|
||||
|
||||
Reference in New Issue
Block a user