mirror of
https://github.com/Ukendio/jecs.git
synced 2025-09-23 00:29:18 +00:00
Allow any amount of undefined in bulk_insert
This commit is contained in:
parent
35cb0bca4e
commit
c42a481948
1 changed files with 2 additions and 1 deletions
3
jecs.d.ts
vendored
3
jecs.d.ts
vendored
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue