From 97d6955da08c081c738af2e8186f0d8d40eda27c Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:29:30 -0400 Subject: [PATCH] Sync typescript types (v0.2.2) (#65) * Sync typescript types to 0.2.2 * semicolon --- src/index.d.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 66ae62d..6ab901a 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,5 +1,20 @@ type Query = { - without: (...components: Entity[]) => Query; + + /** + * this: Query is necessary to use a colon instead of a period for emits. + */ + + /** + * Modifies the Query to exclude specified components + * @param components The components to exclude + * @returns Modified Query + */ + without: (this: Query, ...components: Entity[]) => Query; + /** + * Modifies component data with a callback function + * @param fn The function to modify data + */ + replace: (this: Query, fn: (...components: T) => T extends [infer U] ? U : LuaTuple) => void; } & IterableFunction>; // Utility Types @@ -126,7 +141,7 @@ export class World { /** * Searches the world for entities that match a given query * @param components Queried Components - * @returns Iterable function + * @returns Query */ query(...components: T): Query>; } @@ -146,6 +161,11 @@ export const pair: (pred: Entity, obj: Entity) => Entity; */ export const IS_PAIR: (e: Entity) => boolean; +/** + * Built-in Component used to find every component id + */ +export const Component: Entity; + export const OnAdd: Entity; export const OnRemove: Entity; export const OnSet: Entity;