fix: type compatible with v9 tag definition, support Context as scope in various render APIs, #570

This commit is contained in:
Jun Yang
2022-12-18 12:48:06 +08:00
parent 7526d4062d
commit fb6a9f8717
5 changed files with 55 additions and 20 deletions
+3 -2
View File
@@ -7,8 +7,9 @@ import { Context } from '../context'
import type { Liquid } from '../liquid'
export interface TagImplOptions {
parse?: (this: Tag, token: TagToken, remainingTokens: TopLevelToken[]) => void;
render: (this: Tag, ctx: Context, emitter: Emitter, hash: Record<string, any>) => TagRenderReturn;
[key: string]: any
parse?: (this: Tag & TagImplOptions, token: TagToken, remainingTokens: TopLevelToken[]) => void;
render: (this: Tag & TagImplOptions, ctx: Context, emitter: Emitter, hash: Record<string, any>) => TagRenderReturn;
}
export function createTagClass (options: TagImplOptions): TagClass {