mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +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.
|
||||
*/
|
||||
|
||||
drain: (this: Query<T>) => Query<T>
|
||||
with: (this: Query<T>, ...components: Entity[]) => Query<T>
|
||||
/**
|
||||
* Modifies the Query to exclude specified components
|
||||
* @param components The components to exclude
|
||||
|
|
|
@ -723,7 +723,6 @@ local Arm = function(self: Query, ...)
|
|||
end
|
||||
local world_query
|
||||
do
|
||||
|
||||
local EmptyQuery: Query = {
|
||||
__iter = function(): Item
|
||||
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 QueryShim<T...> = typeof(setmetatable({
|
||||
without = function(...): QueryShim<T...>
|
||||
return nil :: any
|
||||
end,
|
||||
without = noop :: (QueryShim<T...>, ...i53) -> QueryShim<T...>,
|
||||
with = noop :: (QueryShim<T...>, ...i53) -> QueryShim<T...>,
|
||||
drain = noop :: (QueryShim<T...>) -> QueryShim<T...>,
|
||||
replace = noop :: (QueryShim<T...>, fn: (T...) -> T...) -> (),
|
||||
}, {
|
||||
__iter = function(): () -> (number, T...)
|
||||
return nil :: any
|
||||
|
|
Loading…
Reference in a new issue