Improve type of HandlebarsTemplateDelegate

Adds an optional type argument that should be useful for .hbs.d.ts files.

The RuntimeOptions were specified by looking at https://github.com/wycats/handlebars.js/blob/680ec96/lib/handlebars/runtime.js#L131-L171 -- these don't seem to be documented anywhere.
This commit is contained in:
Diogo Franco
2017-07-04 11:28:17 +09:00
committed by GitHub
parent aa06fc4b78
commit c4091e4888
+10 -2
View File
@@ -96,8 +96,8 @@ interface HandlebarsTemplatable {
template: HandlebarsTemplateDelegate;
}
interface HandlebarsTemplateDelegate {
(context: any, options?: any): string;
interface HandlebarsTemplateDelegate<T = any> {
(context: T, options?: RuntimeOptions): string;
}
interface HandlebarsTemplates {
@@ -108,6 +108,14 @@ interface TemplateSpecification {
}
interface RuntimeOptions {
partial?: boolean;
depths?: any[];
helpers?: { [name: string]: Function }
partials?: { [name: string]: HandlebarsTemplateDelegate }
decorators?: { [name: string]: Function }
}
interface CompileOptions {
data?: boolean;
compat?: boolean;