mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Sync typescript types (v0.2.2) (#65)
* Sync typescript types to 0.2.2 * semicolon
This commit is contained in:
parent
4e9aa2ced0
commit
97d6955da0
1 changed files with 22 additions and 2 deletions
24
src/index.d.ts
vendored
24
src/index.d.ts
vendored
|
@ -1,5 +1,20 @@
|
||||||
type Query<T extends unknown[]> = {
|
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]>>;
|
} & IterableFunction<LuaTuple<[Entity, ...T]>>;
|
||||||
|
|
||||||
// Utility Types
|
// Utility Types
|
||||||
|
@ -126,7 +141,7 @@ export class World {
|
||||||
/**
|
/**
|
||||||
* Searches the world for entities that match a given query
|
* Searches the world for entities that match a given query
|
||||||
* @param components Queried Components
|
* @param components Queried Components
|
||||||
* @returns Iterable function
|
* @returns Query
|
||||||
*/
|
*/
|
||||||
query<T extends Entity[]>(...components: T): Query<InferComponents<T>>;
|
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;
|
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 OnAdd: Entity;
|
||||||
export const OnRemove: Entity;
|
export const OnRemove: Entity;
|
||||||
export const OnSet: Entity;
|
export const OnSet: Entity;
|
||||||
|
|
Loading…
Reference in a new issue