Allow any amount of undefined in bulk_insert

This commit is contained in:
daimond113 2025-09-21 18:42:35 +02:00
parent 35cb0bca4e
commit c42a481948
No known key found for this signature in database

3
jecs.d.ts vendored
View file

@ -350,12 +350,13 @@ export type ComponentRecord = {
export function component_record(world: World, id: Id): ComponentRecord;
type TagToUndefined<T> = T extends TagDiscriminator ? undefined : T
type TrimUndefined<T extends unknown[]> = T extends [...infer R, undefined] ? TrimUndefined<R> : T
export function bulk_insert<const C extends Id[]>(
world: World,
entity: Entity,
ids: C,
values: { [K in keyof C]: TagToUndefined<InferComponent<C[K]>> },
values: [...TrimUndefined<{ [K in keyof C]: TagToUndefined<InferComponent<C[K]>> }>, ...undefined[]],
): void;
export function bulk_remove(world: World, entity: Entity, ids: Id[]): void;