diff --git a/types/handlebars/handlebars-tests.ts b/types/handlebars/handlebars-tests.ts index 1ec2528db3..340bbde590 100644 --- a/types/handlebars/handlebars-tests.ts +++ b/types/handlebars/handlebars-tests.ts @@ -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(''); Handlebars.helpers !== undefined; + +const parsedTmpl = Handlebars.parse('

Hello, my name is {{name}}.

', { + srcName: "/foo/bar/baz.hbs", + ignoreStandalone: true +}); + +const parsedTmplWithoutOptions = Handlebars.parse('

Hello, my name is {{name}}.

'); diff --git a/types/handlebars/index.d.ts b/types/handlebars/index.d.ts index 6272dde3a0..d6bebcb457 100644 --- a/types/handlebars/index.d.ts +++ b/types/handlebars/index.d.ts @@ -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(input: any, options?: CompileOptions): HandlebarsTemplateDelegate; export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification; export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate; diff --git a/types/handlebars/tsconfig.json b/types/handlebars/tsconfig.json index 5c7bf000d0..0008e2154e 100644 --- a/types/handlebars/tsconfig.json +++ b/types/handlebars/tsconfig.json @@ -19,9 +19,5 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "handlebars-tests.ts" - ] -} \ No newline at end of file + } +}