From 91bbf4c1b2d6b1fe7e02c20b47e7d04dad3a573f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yuri=20Ara=C3=BAjo?= Date: Mon, 22 Oct 2018 13:09:14 -0300 Subject: [PATCH] Mustache: tags should be a string array (#29886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Parameter update according to Mustache documentation * correction in comment * Version * Substituição de tipo any por string[] --- types/mustache/index.d.ts | 19 ++++++++++++++----- types/mustache/mustache-tests.ts | 6 +++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/types/mustache/index.d.ts b/types/mustache/index.d.ts index 2b0ab91cd0..77b8880fdd 100644 --- a/types/mustache/index.d.ts +++ b/types/mustache/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mustache 0.8.3 +// Type definitions for Mustache 0.8.4 // Project: https://github.com/janl/mustache.js // Definitions by: Mark Ashley Bell , Manuel Thalmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -20,7 +20,7 @@ interface MustacheStatic { /** * The opening and closing tags to parse. */ - tags: string; + tags: string[]; /** * A simple string scanner that is used by the template parser to find tokens in template strings. @@ -80,8 +80,11 @@ interface MustacheStatic { * -- or -- * * A function that is used to load partial template on the fly that takes a single argument: the name of the partial. + * + * @param tags + * The tags to use. */ - render(template: string, view: any | MustacheContext, partials?: any): string; + render(template: string, view: any | MustacheContext, partials?: any, tags?: string[]): string; /** * Renders the `template` with the given `view` and `partials` using the default writer. @@ -198,8 +201,11 @@ declare class MustacheWriter { * * @param template * The template to parse. + * + * @param tags + * The tags to use. */ - parse(template: string, tags?: any): any; + parse(template: string, tags?: string[]): any; /** * High-level method that is used to render the given `template` with the given `view`. @@ -216,8 +222,11 @@ declare class MustacheWriter { * -- or -- * * A function that is used to load partial template on the fly that takes a single argument: the name of the partial. + * + * @param tags + * The tags to use. */ - render(template: string, view: any | MustacheContext, partials: any): string; + render(template: string, view: any | MustacheContext, partials: any, tags?: string[]): string; /** * Low-level method that renders the given array of `tokens` using the given `context` and `partials`. diff --git a/types/mustache/mustache-tests.ts b/types/mustache/mustache-tests.ts index 30c920a30a..bca7d5a40e 100644 --- a/types/mustache/mustache-tests.ts +++ b/types/mustache/mustache-tests.ts @@ -26,4 +26,8 @@ var view4 = new class extends Mustache.Context } }; var template4 = "Hello, {{firstName}} {{lastName}}"; -var html4 = Mustache.render(template4, view4); \ No newline at end of file +var html4 = Mustache.render(template4, view4); + +var view5 = { title: "Joe", calc: function () { return 2 + 4; } }; +var template5 = "[[title]] spends [[calc]]"; +var output5 = Mustache.render(template5, view5, {}, ["[[", "]]"]); \ No newline at end of file