Skip to main content
Version: v2.10.0

Structure

Table of Contentsโ€‹

Class Definitionโ€‹

export abstract class Structure {}
info

Structure is an abstract utility class. All members are static โ€” it cannot be instantiated directly.

Methodsโ€‹

extend()โ€‹

static extend<K extends keyof Extendable, T extends Extendable[K]>(name: K, extender: (target: Extendable[K]) => T): T

Replaces a built-in class with an extended version. The extender function receives the current class and must return a subclass of it.

Parametersโ€‹

Parameter Type Description Optional
namestringThe name of the structure to replace. Must be a key of Extendable.
extenderFunctionA function that receives the current class and returns the extended version.

Returnsโ€‹

Type Description
TThe extended class.

get()โ€‹

static get<K extends keyof Extendable>(name: K): Extendable[K]

Returns the current class registered under the given name โ€” either the built-in or a previously extended version.

Parametersโ€‹

Parameter Type Description Optional
namestringThe name of the structure to retrieve. Must be a key of Extendable.

Returnsโ€‹

Type Description
Extendable[K]The registered class for the given key.