DefinitelyTyped/types/twig/twig-tests.ts
2020-05-14 19:20:31 -07:00

58 lines
1.1 KiB
TypeScript

import twig = require('twig');
const value: any = "";
const str = "";
const num = 0;
const bool = false;
const params: twig.Parameters = {
id: value,
path: value,
base: value,
blocks: value,
macros: value,
method: value,
name: value,
options: value,
href: value,
async: value
};
const temp: twig.Template = twig.twig(params);
const result: string = temp.render();
const async_result: string | Promise<string> = temp.render(undefined, undefined, true);
function twig_async_param(b: boolean) {
const maybe_async_result: string | Promise<string> = temp.render(undefined, undefined, b);
}
twig_async_param(true);
twig_async_param(false);
const compOpts: twig.CompileOptions = {
filename: str,
settings: value
};
twig.extendFilter(str, (left: any, ...params: any[]) => {
return str;
});
twig.extendFunction(str, (...params: any[]) => {
return str;
});
twig.extendTest(str, (value: any) => bool);
twig.extendTag(value);
const compiled = twig.compile(str, compOpts);
twig.renderFile(str, compOpts, (err, result) => {
});
twig.__express(str, compOpts, (err, result) => {
});
twig.cache(bool);