Add typings for bulk operations

This commit is contained in:
daimond113 2025-07-16 14:44:57 +02:00
parent 210d62d463
commit 15cf96ecc3
No known key found for this signature in database
GPG key ID: 640DC95EC1190354
2 changed files with 6 additions and 3 deletions

3
jecs.d.ts vendored
View file

@ -321,3 +321,6 @@ export type ComponentRecord = {
}
export function component_record(world: World, id: Id): ComponentRecord
export function bulk_insert<const C extends Entity[]>(world: World, entity: Entity, ids: C, values: InferComponents<C>): void
export function bulk_remove(world: World, entity: Entity, ids: Entity[]): void

View file

@ -2033,7 +2033,7 @@ local function world_children<a>(world: World, parent: Id<a>)
return world_each(world, ECS_PAIR(EcsChildOf, parent::number))
end
local function ecs_bulk_insert(world: World, entity: Entity, ids: { Entity }, values: { any })
local function ecs_bulk_insert(world: World, entity: Entity, ids: { Id }, values: { any })
local entity_index = world.entity_index
local r = entity_index_try_get(entity_index, entity)
if not r then
@ -2111,7 +2111,7 @@ local function ecs_bulk_insert(world: World, entity: Entity, ids: { Entity }, va
end
end
local function ecs_bulk_remove(world: World, entity: Entity, ids: { Entity })
local function ecs_bulk_remove(world: World, entity: Entity, ids: { Id })
local entity_index = world.entity_index
local r = entity_index_try_get(entity_index, entity)
if not r then
@ -2123,7 +2123,7 @@ local function ecs_bulk_remove(world: World, entity: Entity, ids: { Entity })
return
end
local remove: { [Entity]: boolean } = {}
local remove: { [Id]: boolean } = {}
local columns_map = from.columns_map