mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #31380 from zimmi88/handlebarsUpdateParseParams
Update typings for handlebars: Add options param to parse
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
//import Handlebars = require('handlebars');
|
||||
import * as Handlerbars from 'handlebars';
|
||||
import * as Handlebars from 'handlebars';
|
||||
|
||||
const context = {
|
||||
author: { firstName: 'Alan', lastName: 'Johnson' },
|
||||
@@ -78,3 +78,10 @@ template6([{url:"", title:""}])
|
||||
const escapedExpression = Handlebars.Utils.escapeExpression('<script>alert(\'xss\');</script>');
|
||||
|
||||
Handlebars.helpers !== undefined;
|
||||
|
||||
const parsedTmpl = Handlebars.parse('<p>Hello, my name is {{name}}.</p>', {
|
||||
srcName: "/foo/bar/baz.hbs",
|
||||
ignoreStandalone: true
|
||||
});
|
||||
|
||||
const parsedTmplWithoutOptions = Handlebars.parse('<p>Hello, my name is {{name}}.</p>');
|
||||
|
||||
Vendored
+6
-1
@@ -35,6 +35,11 @@ declare namespace Handlebars {
|
||||
[key: string]: HelperDelegate;
|
||||
}
|
||||
|
||||
export interface ParseOptions {
|
||||
srcName?: string,
|
||||
ignoreStandalone?: boolean
|
||||
}
|
||||
|
||||
export function registerHelper(name: string, fn: HelperDelegate): void;
|
||||
export function registerHelper(name: HelperDeclareSpec): void;
|
||||
export function unregisterHelper(name: string): void;
|
||||
@@ -52,7 +57,7 @@ declare namespace Handlebars {
|
||||
export function blockParams(obj: any[], ids: any[]): any[];
|
||||
export function Exception(message: string): void;
|
||||
export function log(level: number, obj: any): void;
|
||||
export function parse(input: string): hbs.AST.Program;
|
||||
export function parse(input: string, options?: ParseOptions): hbs.AST.Program;
|
||||
export function compile<T = any>(input: any, options?: CompileOptions): HandlebarsTemplateDelegate<T>;
|
||||
export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification;
|
||||
export function template<T = any>(precompilation: TemplateSpecification): HandlebarsTemplateDelegate<T>;
|
||||
|
||||
@@ -19,9 +19,5 @@
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"handlebars-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user