Mustache: tags should be a string array (#29886)

* Parameter update according to Mustache documentation

* correction in comment

* Version

* Substituição de tipo any por string[]
This commit is contained in:
Yuri Araújo 2018-10-22 13:09:14 -03:00 committed by Sheetal Nandi
parent 9566c07768
commit 91bbf4c1b2
2 changed files with 19 additions and 6 deletions

View File

@ -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 <https://github.com/markashleybell>, Manuel Thalmann <https://github.com/manuth>
// 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`.

View File

@ -26,4 +26,8 @@ var view4 = new class extends Mustache.Context
}
};
var template4 = "Hello, {{firstName}} {{lastName}}";
var html4 = Mustache.render(template4, view4);
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, {}, ["[[", "]]"]);