Add types

This commit is contained in:
Ukendio 2026-02-16 02:04:35 +01:00
parent 30597ed389
commit 22dd91b111
2 changed files with 4 additions and 2 deletions

4
src/jecs.d.ts vendored
View file

@ -76,9 +76,11 @@ export type CachedQuery<T extends Id[]> = {
* Returns the matched archetypes of the query * Returns the matched archetypes of the query
* @returns An array of archetypes of the query * @returns An array of archetypes of the query
*/ */
archetypes(): Archetype<T>[]; archetypes(override?: boolean): Archetype<T>[];
has(entity: Entity): boolean; has(entity: Entity): boolean;
fini(): void
} & Iter<T>; } & Iter<T>;
export type Query<T extends Id[]> = { export type Query<T extends Id[]> = {

View file

@ -87,7 +87,7 @@ type TypePack<T...> = (T...) -> never
export type Cached_Query<T...> = typeof(setmetatable( export type Cached_Query<T...> = typeof(setmetatable(
{} :: { {} :: {
iter: Cached_Query_Iter<T...>, iter: Cached_Query_Iter<T...>,
archetypes: (Cached_Query<T...>) -> { Archetype }, archetypes: (Cached_Query<T...>, override: boolean?) -> { Archetype },
has: (Cached_Query<T...>, Entity) -> boolean, has: (Cached_Query<T...>, Entity) -> boolean,
fini: (Cached_Query<T...>) -> (), fini: (Cached_Query<T...>) -> (),