Optionalspec: TSpecThe spec this instance was constructed with — stored verbatim, not cloned. Every own key is also lifted onto the instance by init.
Spec keys whose values are sub-types (e.g. ["values"], ["keys", "values"]).
init resolves them to PropType instances on the instance, defaulting
to PropType.any so this.values.parse(v) works unconditionally.
StaticanyShared fallback returned by PropType.for when no type is specified or matched.
StaticregistryCreate a new type that inherits from this one. Mainly used internally.
Null/undefined produce null (signaling attribute removal).
Is this type a kind of other — i.e. is other this or anywhere up
its super chain? Replaces instanceof checks (abstract types aren't
JS classes).
StaticforResolve any user-facing type identifier into a PropType:
PropType (as-is), constructor (registry → fresh {is} derivative),
string (globalThis → registry → fallback), spec object (singleton
if bare, otherwise a derivative), or nullish (fallback).
Optionaloptions: { fallback?: PropType } = {}StaticnormalizeResolve an is identifier to its registry key: strings are looked up on
globalThis (catches built-ins like "Array"); anything else passes
through as-is (including named-only abstracts like "Iterable").
StaticregisterConstruct a type and store it in PropType.registry, keyed on
spec.is (constructor) or spec.name (abstract).
Type adapter for prop values: defines equality, parsing from raw input (typically attribute strings), and stringification back to attributes.
Instances are abstract, prop-agnostic type definitions. The registry keys concretes by JS constructor (
is) and abstracts byname; derivatives areObject.create(parent)so option lookup walks the prototype chain. The parent comes fromspec.extendsor, failing that,registry.get(spec.is)— so e.g.{is: Array, extends: Iterable}decouples the chain parent from the produced JS type.init lifts every spec key onto the instance. Method overrides (
equals/parse/stringify) go through their matchingget_<name>transform on the prototype, which wraps them with the shared null/identity short-circuits and super-walking. Other methods are lifted verbatim and can call into the next implementation via the super proxy.Template: TSpec