Import
import { HtmlSparsePartChunk } from "@typed/template";Signatures
export interface HtmlSparsePartChunk {
readonly _tag: "sparse-part";
readonly node: Template.SparsePartNode;
readonly render: (value: unknown) => string;
}Why
Sparse values preserve surrounding literal text while serializing each interpolation according to its HTML context.
Ownership and lifetime
The record owns no subscription; the consuming renderer evaluates it.
Property: _tag
Identifies a sparse dynamic chunk.
Property: _tag: Why
Enables exhaustive renderer dispatch.
Property: _tag: Ownership and lifetime
Immutable metadata owned by the chunk.
Property: node
The parsed sparse part retaining literal/dynamic ordering.
Property: node: Why
Preserves the serialization context across all segments.
Property: node: Ownership and lifetime
The chunk borrows the immutable AST node.
Property: render
Function to render the value of this part into a string.
Property: render: Why
Sparse parts retain one context-aware escaping boundary.
Property: render: Ownership and lifetime
The pure function retains no application value between calls.
Examples
import { templateToHtmlChunks, type HtmlSparsePartChunk } from "@typed/template/HtmlChunk"
import { parse } from "@typed/template/Parser"
const chunk = templateToHtmlChunks(parse(["<p title=\"before ", " after\"></p>"]))[1] as HtmlSparsePartChunkOther public imports
These import paths expose the same declaration. Each page retains its own public name and signature.