Is there a more clear way in rescript to get the variant type, not the payload? Now I use pattern matching to do this. Maybe more graceful solution exist?
type component =
| Position(Vector2.t)
| Velocity(Vector2.t)
I can use functions of type isComponentName with arrays of components or other sets.
Something like this:
let cArray = [Position({x: 130.6, y: 200.2}), Velocity({x: 0.015, y: 0.01})]
let index = cArray->Belt.Array.getIndexBy(isVelocity)
let exist = cArray->Belt.Array.some(isVelocity)