diff --git a/src/jecs.d.ts b/src/jecs.d.ts index 0d306a5..11e7068 100755 --- a/src/jecs.d.ts +++ b/src/jecs.d.ts @@ -172,8 +172,8 @@ export class World { * @param hook The hook to install. * @param value The hook callback. */ - set(component: Entity, hook: StatefulHook, value: (e: Entity, id: Id, data: T) => void): void; - set(component: Entity, hook: StatelessHook, value: (e: Entity, id: Id) => void): void; + set(component: Entity, hook: HookWithData, value: (e: Entity, id: Id, data: T) => void): void; + set(component: Entity, hook: HookWithDeleted, value: (e: Entity, id: Id, deleted?: true) => void): void; /** * Assigns a value to a component on the given entity. * @param entity The target entity. @@ -277,7 +277,7 @@ export class World { added(component: Entity, listener: (e: Entity, id: Id, value: T) => void): () => void; changed(component: Entity, listener: (e: Entity, id: Id, value: T) => void): () => void; - removed(component: Entity, listener: (e: Entity, id: Id) => void): () => void; + removed(component: Entity, listener: (e: Entity, id: Id, deleted?: true) => void): () => void; } export function world(): World; @@ -323,16 +323,16 @@ export function pair_second(world: World, p: Pair): Entity; export function ECS_PAIR_FIRST(pair: Pair): number; export function ECS_PAIR_SECOND(pair: Pair): number; -type StatefulHook = Entity<(e: Entity, id: Id, data: T) => void> & { - readonly __nominal_StatefulHook: unique symbol; +type HookWithData = Entity<(e: Entity, id: Id, data: T) => void> & { + readonly __nominal_HookWithData: unique symbol; }; -type StatelessHook = Entity<(e: Entity, id: Id) => void> & { - readonly __nominal_StatelessHook: unique symbol; +type HookWithDeleted = Entity<(e: Entity, id: Id, deleted?: true) => void> & { + readonly __nominal_HookWithDeleted: unique symbol; }; -export declare const OnAdd: StatefulHook; -export declare const OnRemove: StatelessHook; -export declare const OnChange: StatefulHook; +export declare const OnAdd: HookWithData; +export declare const OnRemove: HookWithDeleted; +export declare const OnChange: HookWithData; export declare const ChildOf: Tag; export declare const Component: Tag; export declare const Wildcard: Entity;