class / @typed/template

AttributeNode

Represents a static attribute (e.g. class="foo").

Package version
1.0.0-beta.13
Category
Attribute syntax
Since
1.0.0

Import

import { AttributeNode } from "@typed/template";

Signatures

export declare class AttributeNode {
    readonly _tag: "attribute";
    readonly name: string;
    readonly value: string;
    constructor(name: string, value: string);
}

Why

Static authored names and values can be compiled once without a dynamic updater.

Ownership and lifetime

The model owns strings only; the renderer creates the native Attr.

Constructor

Creates static attribute syntax.

Property: _tag

Static-attribute discriminant.

Property: _tag: Why

Selects one-time native attribute creation and SSR serialization.

Property: _tag: Ownership and lifetime

Immutable AST metadata.

Property: name

Native attribute name.

Property: name: Why

Preserves the authored attribute target.

Property: name: Ownership and lifetime

Retained string metadata.

Property: value

Authored static value.

Property: value: Why

Compiles without a dynamic producer.

Property: value: Ownership and lifetime

Retained string metadata.

Examples

import { AttributeNode } from "@typed/template/Template"

const node = new AttributeNode("class", "notice")

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source