|
| 1 | +declare module '@profoundlogic/hogan' { |
| 2 | + export interface Context { |
| 3 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 4 | + [key: string]: any; |
| 5 | + } |
| 6 | + |
| 7 | + export interface SectionTags { |
| 8 | + o: string; |
| 9 | + c: string; |
| 10 | + } |
| 11 | + |
| 12 | + export interface HoganOptions { |
| 13 | + asString?: boolean | undefined; |
| 14 | + sectionTags?: readonly SectionTags[] | undefined; |
| 15 | + delimiters?: string | undefined; |
| 16 | + disableLambda?: boolean | undefined; |
| 17 | + } |
| 18 | + |
| 19 | + export interface Token { |
| 20 | + tag: string; |
| 21 | + otag?: string | undefined; |
| 22 | + ctag?: string | undefined; |
| 23 | + i?: number | undefined; |
| 24 | + n?: string | undefined; |
| 25 | + text?: string | undefined; |
| 26 | + } |
| 27 | + |
| 28 | + export interface Leaf extends Token { |
| 29 | + end: number; |
| 30 | + nodes: Token[]; |
| 31 | + } |
| 32 | + |
| 33 | + export type Tree = Leaf[]; |
| 34 | + |
| 35 | + export interface Partials { |
| 36 | + [symbol: string]: HoganTemplate; |
| 37 | + } |
| 38 | + |
| 39 | + export class HoganTemplate { |
| 40 | + render(context: Context, partials?: Partials, indent?: string): string; |
| 41 | + } |
| 42 | + |
| 43 | + export { HoganTemplate as Template, HoganTemplate as template }; |
| 44 | + |
| 45 | + export function compile(text: string, options?: HoganOptions & { asString: false }): HoganTemplate; |
| 46 | + export function compile(text: string, options?: HoganOptions & { asString: true }): string; |
| 47 | + export function compile(text: string, options?: HoganOptions): HoganTemplate | string; |
| 48 | + |
| 49 | + export function scan(text: string, delimiters?: string): Token[]; |
| 50 | + |
| 51 | + export function parse(tokens: readonly Token[], text?: undefined, options?: HoganOptions): Tree; |
| 52 | +} |
0 commit comments