Sync typescript types (v0.2.2) (#65)

* Sync typescript types to 0.2.2

* semicolon
This commit is contained in:
EncodedVenom 2024-07-07 16:29:30 -04:00 committed by GitHub
parent 4e9aa2ced0
commit 97d6955da0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

24
src/index.d.ts vendored
View file

@ -1,5 +1,20 @@
type Query<T extends unknown[]> = {
without: (...components: Entity[]) => Query<T>;
/**
* this: Query<T> 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<T>, ...components: Entity[]) => Query<T>;
/**
* Modifies component data with a callback function
* @param fn The function to modify data
*/
replace: (this: Query<T>, fn: (...components: T) => T extends [infer U] ? U : LuaTuple<T>) => void;
} & IterableFunction<LuaTuple<[Entity, ...T]>>;
// 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<T extends Entity[]>(...components: T): Query<InferComponents<T>>;
}
@ -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;