mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 17:40:02 +00:00
Fix query types
This commit is contained in:
parent
35387c06e0
commit
ecd7b9f89e
2 changed files with 131 additions and 130 deletions
3
src/index.d.ts
vendored
3
src/index.d.ts
vendored
|
@ -3,7 +3,8 @@ type Query<T extends unknown[]> = {
|
||||||
/**
|
/**
|
||||||
* this: Query<T> is necessary to use a colon instead of a period for emits.
|
* this: Query<T> is necessary to use a colon instead of a period for emits.
|
||||||
*/
|
*/
|
||||||
|
drain: (this: Query<T>) => Query<T>
|
||||||
|
with: (this: Query<T>, ...components: Entity[]) => Query<T>
|
||||||
/**
|
/**
|
||||||
* Modifies the Query to exclude specified components
|
* Modifies the Query to exclude specified components
|
||||||
* @param components The components to exclude
|
* @param components The components to exclude
|
||||||
|
|
|
@ -723,7 +723,6 @@ local Arm = function(self: Query, ...)
|
||||||
end
|
end
|
||||||
local world_query
|
local world_query
|
||||||
do
|
do
|
||||||
|
|
||||||
local EmptyQuery: Query = {
|
local EmptyQuery: Query = {
|
||||||
__iter = function(): Item
|
__iter = function(): Item
|
||||||
return noop
|
return noop
|
||||||
|
@ -1214,9 +1213,10 @@ export type Entity<T = any> = number & { __DO_NOT_USE_OR_YOU_WILL_BE_FIRED: T }
|
||||||
export type Pair = number
|
export type Pair = number
|
||||||
|
|
||||||
export type QueryShim<T...> = typeof(setmetatable({
|
export type QueryShim<T...> = typeof(setmetatable({
|
||||||
without = function(...): QueryShim<T...>
|
without = noop :: (QueryShim<T...>, ...i53) -> QueryShim<T...>,
|
||||||
return nil :: any
|
with = noop :: (QueryShim<T...>, ...i53) -> QueryShim<T...>,
|
||||||
end,
|
drain = noop :: (QueryShim<T...>) -> QueryShim<T...>,
|
||||||
|
replace = noop :: (QueryShim<T...>, fn: (T...) -> T...) -> (),
|
||||||
}, {
|
}, {
|
||||||
__iter = function(): () -> (number, T...)
|
__iter = function(): () -> (number, T...)
|
||||||
return nil :: any
|
return nil :: any
|
||||||
|
|
Loading…
Reference in a new issue