DefinitelyTyped/types/hogan.js/hogan.js-tests.ts
2019-09-25 10:30:30 -07:00

25 lines
521 B
TypeScript

import Hogan = require('hogan.js');
// $ExpectType HoganTemplate
const compiled = Hogan.compile("{{#if}}{{value}}{{/if}}");
// $ExpectType string
Hogan.compile("<%_foo%><%value%><%/foo%>", {
asString: true,
sectionTags: [{
o: '_foo',
c: 'foo'
}],
delimiters: '<% %>',
disableLambda: true
});
// $ExpectType string
compiled.render({ value: "test" });
// $ExpectType Token[]
const scanned = Hogan.scan("{{#if}}{{value}}{{/if}}");
// $ExpectType Leaf[] || Tree
Hogan.parse(scanned);