Utility type to derive the entity type that would result from a query definition. This is useful for creating helper functions that operate on query results.
const queryDef = { with: ['position', 'sprite'], without: ['dead']};type EntityType = QueryResultEntity<Components, typeof queryDef>;function updateSpritePosition(entity: EntityType) { entity.components.sprite.position.set( entity.components.position.x, entity.components.position.y );} Copy
const queryDef = { with: ['position', 'sprite'], without: ['dead']};type EntityType = QueryResultEntity<Components, typeof queryDef>;function updateSpritePosition(entity: EntityType) { entity.components.sprite.position.set( entity.components.position.x, entity.components.position.y );}
Utility type to derive the entity type that would result from a query definition. This is useful for creating helper functions that operate on query results.