mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-03 18:59:18 +00:00
feat: move InferComponents into Iter
This commit is contained in:
parent
535b9f24b6
commit
2b9c04c90a
1 changed files with 5 additions and 5 deletions
10
jecs.d.ts
vendored
10
jecs.d.ts
vendored
|
@ -52,26 +52,26 @@ export type Archetype<T extends Id[]> = {
|
|||
columns_map: { [K in T[number]]: Column<InferComponent<K>> };
|
||||
};
|
||||
|
||||
type Iter<T extends unknown[]> = IterableFunction<LuaTuple<[Entity, ...T]>>;
|
||||
type Iter<T extends Id[]> = IterableFunction<LuaTuple<[Entity, ...InferComponents<T>]>>;
|
||||
|
||||
export type CachedQuery<T extends Id[]> = {
|
||||
/**
|
||||
* Returns an iterator that produces a tuple of [Entity, ...queriedComponents].
|
||||
*/
|
||||
iter(): Iter<InferComponents<T>>;
|
||||
iter(): Iter<T>;
|
||||
|
||||
/**
|
||||
* Returns the matched archetypes of the query
|
||||
* @returns An array of archetypes of the query
|
||||
*/
|
||||
archetypes(): Archetype<T>[];
|
||||
} & Iter<InferComponents<T>>;
|
||||
} & Iter<T>;
|
||||
|
||||
export type Query<T extends Id[]> = {
|
||||
/**
|
||||
* Returns an iterator that produces a tuple of [Entity, ...queriedComponents].
|
||||
*/
|
||||
iter(): Iter<InferComponents<T>>;
|
||||
iter(): Iter<T>;
|
||||
|
||||
/**
|
||||
* Creates and returns a cached version of this query for efficient reuse.
|
||||
|
@ -99,7 +99,7 @@ export type Query<T extends Id[]> = {
|
|||
* @returns An array of archetypes of the query
|
||||
*/
|
||||
archetypes(): Archetype<T>[];
|
||||
} & Iter<InferComponents<T>>;
|
||||
} & Iter<T>;
|
||||
|
||||
export class World {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue