forked from patrickpissurno/li-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lit.d.ts
66 lines (57 loc) · 2.33 KB
/
lit.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Type definitions for li-template
// Project: li-template
// Definitions by: Patrick Pissurno <https://patrickpissurno.com.br>
export = Lit;
declare namespace Lit {
export interface IPartial {
name: string;
render: IRenderer;
}
export interface IRenderer {
(data: object): string;
}
/**
*
* Async compile a template by passing its raw content
* @export
* @param {string} raw Template's raw content
* @param {IPartial[]} partials Array of already compiled partial files
* @param {{ filename?: string, precompiled?: string }} [opt] Optional parameters
* @returns {Promise<IRenderer>} The compiled render function wrapped in a Promise
*/
export function compile(raw: string, partials: IPartial[], opt?:{ filename?: string, precompiled?: string }): Promise<IRenderer>;
/**
*
* Async compile a template by passing its file name
* @export
* @param {string} filename Template's file name
* @param {string[]} partials An array containing the file names of all partials needed for this template
* @returns {Promise<IRenderer>} The compiled render function wrapped in a Promise
*/
export function compileFile(filename: string, partials: string[]): Promise<IRenderer>;
/**
*
* Async compile partials from a string array of file names
* @export
* @param {string[]} partialsFileNames An array containing the file names of all partials needed for this template
* @param {string} [templateName] This template's file name
* @returns {Promise<IPartial[]>} Array of compiled partial files wrapped in a Promise
*/
export function compilePartials(partialsFileNames: string[], templateName?: string): Promise<IPartial[]>;
/**
*
* Pre-compile a template by passing its raw content
* @export
* @param {string} raw Template's raw content
* @returns {string} The pre-compiled render module (as a string)
*/
export function precompile(raw: string): string;
/**
*
* Pre-compile a template by passing its file name
* @export
* @param {string} filename Template's file name
* @returns {Promise<String>} The pre-compiled render module (as a string) wrapped in a Promise
*/
export function precompileFile(filename: string): Promise<String>;
}