class / @typed/template

DocType

Represents a parsed DOCTYPE declaration.

Package version
1.0.0-beta.13
Category
Document structure
Since
1.0.0

Import

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

Signatures

export declare class DocType {
    readonly _tag = "doctype";
    readonly name: string;
    readonly publicId: string | undefined;
    readonly systemId: string | undefined;
    constructor(name: string, publicType?: string, systemId?: string);
}

Why

Renderer-neutral parsing retains document declaration metadata explicitly.

Ownership and lifetime

The value owns strings only and has no document lifetime.

Constructor

Creates a doctype AST node.

Constructor: Why

Makes declaration tooling explicit.

Constructor: Ownership and lifetime

Stores strings only.

Property: _tag

Doctype discriminant.

Property: _tag: Why

Selects declaration serialization.

Property: _tag: Ownership and lifetime

Immutable metadata.

Property: name

Declared document type name.

Property: name: Why

Preserves author declaration data.

Property: name: Ownership and lifetime

Retained string metadata.

Property: publicId

Optional public identifier.

Property: publicId: Why

Preserves complete doctype metadata.

Property: publicId: Ownership and lifetime

Retained string metadata.

Property: systemId

Optional system identifier.

Property: systemId: Why

Preserves complete doctype metadata.

Property: systemId: Ownership and lifetime

Retained string metadata.

Examples

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

const node = new DocType("html")

Other public imports

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

Source