diff --git a/jecs.d.ts b/jecs.d.ts index 9bdc31f..6972f36 100755 --- a/jecs.d.ts +++ b/jecs.d.ts @@ -43,18 +43,18 @@ type InferComponents = { [K in keyof A]: InferComponent }; type ArchetypeId = number; export type Column = T[]; -export type Archetype = { +export type Archetype = { id: number; types: number[]; type: string; entities: number[]; columns: Column[]; - columns_map: Record> + columns_map: { [K in T[number]]: Column> }; }; -type Iter = IterableFunction>; +type Iter = IterableFunction]>>; -export type CachedQuery = { +export type CachedQuery = { /** * Returns an iterator that produces a tuple of [Entity, ...queriedComponents]. */ @@ -67,7 +67,7 @@ export type CachedQuery = { archetypes(): Archetype[]; } & Iter; -export type Query = { +export type Query = { /** * Returns an iterator that produces a tuple of [Entity, ...queriedComponents]. */ @@ -246,11 +246,11 @@ export class World { * @param components The list of components to query. * @returns A Query object to iterate over results. */ - query(...components: T): Query>; + query(...components: T): Query; - 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 + 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; } export function world(): World; @@ -297,11 +297,11 @@ 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, -} + readonly __nominal_StatefulHook: unique symbol; +}; type StatelessHook = Entity<(e: Entity, id: Id) => void> & { - readonly __nominal_StatelessHook: unique symbol, -} + readonly __nominal_StatelessHook: unique symbol; +}; export declare const OnAdd: StatefulHook; export declare const OnRemove: StatelessHook; @@ -319,12 +319,17 @@ export declare const Exclusive: Tag; export declare const Rest: Entity; export type ComponentRecord = { - records: Map, - counts: Map, - size: number, -} + records: Map; + counts: Map; + size: number; +}; -export function component_record(world: World, id: Id): ComponentRecord +export function component_record(world: World, id: Id): ComponentRecord; -export function bulk_insert(world: World, entity: Entity, ids: C, values: InferComponents): void -export function bulk_remove(world: World, entity: Entity, ids: Id[]): void +export function bulk_insert( + world: World, + entity: Entity, + ids: C, + values: InferComponents, +): void; +export function bulk_remove(world: World, entity: Entity, ids: Id[]): void;