API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

T

typeApplicationOf

@codexo/exojs / core / stable

Normalizes an ApplicationLike to its concrete `Application` instance type, letting Scene's second generic accept an `Application` instance type, its constructor, or `typeof someAppInstance` interchangeably. `typeof someAppInstance` only works once the instance already has an explicit, non-inferred type - a fully-inferred `const app = new Application({ scenes: {...} })` cannot be threaded through a self-referential base-scene chain this way (confirmed: TS2506/TS7022 - the inference cycle runs through the un-annotated `const`'s own initializer, which ordinary lazy interface/type-alias resolution does not rescue). Break the cycle with an explicit fixed point instead - a named `Application` subclass with a hand-written registry type: class GameApplication extends Application<GameScenes> {} export const app: GameApplication = new GameApplication({ scenes: {...} }); // in a second module: export abstract class AppScene<Data = void> extends Scene<Data, typeof app> {} The cross-file `import type` this introduces is a type-only module cycle - unproblematic, erased entirely at compile time.

0
props
0
methods
0
events
Import
import { ApplicationOf } from '@codexo/exojs'

Normalizes an ApplicationLike to its concrete `Application` instance type, letting Scene's second generic accept an `Application` instance type, its constructor, or `typeof someAppInstance` interchangeably.

`typeof someAppInstance` only works once the instance already has an explicit, non-inferred type - a fully-inferred `const app = new Application({ scenes: {...} })` cannot be threaded through a self-referential base-scene chain this way (confirmed: TS2506/TS7022 - the inference cycle runs through the un-annotated `const`'s own initializer, which ordinary lazy interface/type-alias resolution does not rescue). Break the cycle with an explicit fixed point instead - a named `Application` subclass with a hand-written registry type:

class GameApplication extends Application<GameScenes> {} export const app: GameApplication = new GameApplication({ scenes: {...} }); // in a second module: export abstract class AppScene<Data = void> extends Scene<Data, typeof app> {}

The cross-file `import type` this introduces is a type-only module cycle - unproblematic, erased entirely at compile time.

Definition1
Source