mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-04 16:04:45 +08:00
Add parameter typing, fix old definition version
I was omitting the -noImplicitAny flag when testing; interestingly, even the old (0.7.3) definitions failed the Travis CI tests...
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/// <reference path="mustache-0.7.0.d.ts" />
|
||||
/// <reference path="mustache-0.7.3.d.ts" />
|
||||
|
||||
var view = { title: "Joe", calc: function () { return 2 + 4; } };
|
||||
var output = Mustache.render("{{title}} spends {{calc}}", view);
|
||||
|
||||
var person;
|
||||
var person = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
|
||||
var template = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template, person);
|
||||
|
||||
+17
-16
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Mustache 0.7
|
||||
// Type definitions for Mustache 0.7.3
|
||||
// Project: https://github.com/janl/mustache.js
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -15,21 +15,22 @@ interface MustacheScanner {
|
||||
}
|
||||
|
||||
interface MustacheContext {
|
||||
view;
|
||||
parent;
|
||||
view: any;
|
||||
parent: MustacheContext;
|
||||
|
||||
clearCache();
|
||||
push(view): MustacheContext;
|
||||
clearCache(): void;
|
||||
push(view: any): MustacheContext;
|
||||
lookup(name: string): any;
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
clearCache();
|
||||
compile(template: string, tags);
|
||||
compilePartial(name, template, tags);
|
||||
compileTokens(tokens, template);
|
||||
render(template, view, partials);
|
||||
|
||||
clearCache(): void;
|
||||
compile(template: string, tags: any): any;
|
||||
compilePartial(name: string, template: string, tags: any): any;
|
||||
compileTokens(tokens: string[], template: string): any;
|
||||
render(template: string, view: any, partials: any): any;
|
||||
}
|
||||
|
||||
interface MustacheStatic {
|
||||
@@ -39,16 +40,16 @@ interface MustacheStatic {
|
||||
Scanner: MustacheScanner;
|
||||
Context: MustacheContext;
|
||||
Writer: MustacheWriter;
|
||||
escape;
|
||||
escape: any;
|
||||
|
||||
parse(template: string, tags);
|
||||
parse(template: string, tags: any): any;
|
||||
clearCache(): MustacheWriter;
|
||||
compile(template: string): MustacheWriter;
|
||||
compile(template: string, tags): MustacheWriter;
|
||||
compilePartial(name: string, template: string, tags): MustacheWriter;
|
||||
compileTokens(tokens, template: string): MustacheWriter;
|
||||
compile(template: string, tags: any): MustacheWriter;
|
||||
compilePartial(name: string, template: string, tags: any): MustacheWriter;
|
||||
compileTokens(tokens: string[], template: string): MustacheWriter;
|
||||
render(template: string, view: any, partials?: any): string;
|
||||
to_html(template: string, view: any, partials?: any, send?): string;
|
||||
to_html(template: string, view: any, partials?: any, send?: any): string;
|
||||
}
|
||||
|
||||
declare var Mustache: MustacheStatic;
|
||||
Vendored
+10
-10
@@ -15,20 +15,20 @@ interface MustacheScanner {
|
||||
}
|
||||
|
||||
interface MustacheContext {
|
||||
view;
|
||||
parent;
|
||||
view: any;
|
||||
parentContext: MustacheContext;
|
||||
|
||||
push(view): MustacheContext;
|
||||
push(view: any): MustacheContext;
|
||||
lookup(name: string): any;
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
|
||||
clearCache();
|
||||
parse(template: string, tags?: any);
|
||||
render(template, view, partials);
|
||||
renderTokens(tokens, context, partials, originalTemplate);
|
||||
clearCache(): void;
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials: any): string;
|
||||
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
|
||||
}
|
||||
|
||||
interface MustacheStatic {
|
||||
@@ -38,12 +38,12 @@ interface MustacheStatic {
|
||||
Scanner: MustacheScanner;
|
||||
Context: MustacheContext;
|
||||
Writer: MustacheWriter;
|
||||
escape;
|
||||
escape: any;
|
||||
|
||||
clearCache(): MustacheWriter;
|
||||
parse(template: string, tags?: any);
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials?: any): string;
|
||||
to_html(template: string, view: any, partials?: any, send?): string;
|
||||
to_html(template: string, view: any, partials?: any, send?: any): any;
|
||||
}
|
||||
|
||||
declare var Mustache: MustacheStatic;
|
||||
|
||||
Reference in New Issue
Block a user