// Option 1: Explicit config type param
const myPlugin = definePlugin<WorldConfigFrom<MyComponents, MyEvents, MyResources>>({
id: 'my-plugin',
install(world) { ... },
});
// Option 2: Single world type param (extracts config automatically)
type MyWorld = typeof ecs;
const myPlugin = definePlugin<MyWorld>({
id: 'my-plugin',
install(world) { ... },
});
Factory function to create a type-safe Plugin with phantom type parameters. The type assertion adds phantom types without runtime cost.
// Option 1: Explicit config type param
const myPlugin = definePlugin<WorldConfigFrom<MyComponents, MyEvents, MyResources>>({
id: 'my-plugin',
install(world) { ... },
});
// Option 2: Single world type param (extracts config automatically)
type MyWorld = typeof ecs;
const myPlugin = definePlugin<MyWorld>({
id: 'my-plugin',
install(world) { ... },
});
Factory function to create a type-safe Plugin with phantom type parameters. The type assertion adds phantom types without runtime cost.