Open iam-yan opened 4 years ago
@robertlong do you have any thoughts on this?
Maybe we could make the type of World
accept an optional generic?
export class World<E = Entity> {
createEntity(name?: string): E
}
Then you could do something like: World<ECSYThreeEntity>
I also need this in systems for query results: https://github.com/MozillaReality/ecsy-three/blob/dev/src/core/System.d.ts
It's a slightly larger change, but I think we could do it.
Issue: In the library when an entity or entity[] is returned, e.g. createEntity function, the return types now are defined as Entity / Entity[]. But in the constructor of World class, one can pass in {entityClass: CustomEntity} to override the default entityClass, in which case all the relevant returned entity should be CustomEntity.
PS: I like how A-Frame is designed and wished to apply it in a wider use cases and found ecsy. Thanks a lot for bringing this fantastic project! !