ecsyjs / ecsy

Entity Component System for javascript
https://ecsyjs.github.io/ecsy/
MIT License
1.11k stars 115 forks source link

Remove undefined from getComponent type #235

Closed robertlong closed 4 years ago

robertlong commented 4 years ago

The undefined union type is technically correct, but makes it really annoying to use in strict mode and there are many other benefits to be gained in strict mode. I think we should try to use the the system query to determine if the entity has the component and only use the undefined union type when we don't know. There may not be a way to do this in typescript though.

fernandojsg commented 4 years ago

cc @sheepsteak