Skip to content

trait

trait<Trait>(token): <T>(target) => T

Defined in: Trait.ts:74

Class decorator that registers a trait on an entity subclass. The type constraint enforces that the class implements all trait members.

@trait(Interactable)
class LightEntity extends Entity {
priority = 4;
interact() { ... } // TS error if missing
}

Trait

TraitToken<Trait>

<T>(target) => T

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.