Remove EntityIndex related type definitions

This commit is contained in:
EncodedVenom 2024-06-15 15:39:00 -04:00
parent 1d51d79f3f
commit 8f72482faf

56
lib/index.d.ts vendored
View file

@ -1,45 +1,7 @@
type Archetype = {
id: number;
edges: {
[key: number]: {
add: Archetype;
remove: Archetype;
};
};
types: Array<number>;
type: string | number;
entities: Array<number>;
columns: Array<Array<unknown>>;
records: { [key: number]: number };
};
type ArchetypeMap = {
cache: Array<number>;
first: ArchetypeMap;
second: ArchetypeMap;
parent: ArchetypeMap;
size: number;
};
type Query<T extends unknown[]> = { type Query<T extends unknown[]> = {
without: (...components: Entity[]) => Query<T>; without: (...components: Entity[]) => Query<T>;
} & IterableFunction<LuaTuple<[Entity, ...T]>>; } & IterableFunction<LuaTuple<[Entity, ...T]>>;
// Exported due to functions below requiring this type.
export type EntityIndex = {
dense: {
[key: number]: number;
};
sparse: {
[key: number]: {
archetype: Archetype;
row: number;
dense: number;
componentRecord: ArchetypeMap;
};
};
};
// Utility Types // Utility Types
export type Entity<T = unknown> = number & { __nominal_type_dont_use: T }; export type Entity<T = unknown> = number & { __nominal_type_dont_use: T };
export type EntityType<T> = T extends Entity<infer A> ? A : never; export type EntityType<T> = T extends Entity<infer A> ? A : never;
@ -176,20 +138,4 @@ export const OnRemove: Entity;
export const OnSet: Entity; export const OnSet: Entity;
export const Wildcard: Entity; export const Wildcard: Entity;
export const w: Entity; export const w: Entity;
export const REST: Entity; export const REST: Entity;
export const IS_PAIR: (e: Entity) => boolean;
export const ECS_ID: (e: Entity) => Entity;
export const ECS_PAIR: (pred: Entity, obj: Entity) => Entity;
export const ECS_GENERATION_INC: (e: Entity) => Entity;
export const ECS_GENERATION: (e: Entity) => Entity;
export const ECS_PAIR_RELATION: <T>(
entityIndex: EntityIndex,
e: Entity<T>
) => Entity;
export const ECS_PAIR_OBJECT: <T>(
entityIndex: EntityIndex,
e: Entity<T>
) => Entity;
export const getAlive: (entityIndex: EntityIndex, id: Entity) => Entity;