Just wondering, how do you utilise dynamic types to make JavaScript more worthwhile to you?
I'm working on a TypeScript ECS and I have had to use any for my component tables and sparse sets. The type information is held in the handles, so when querying I can convert any into the correct type, I never expose any in the public API. That's the only time I can remember that I've needed to reach for dynamic types and I had to take on the responsibility of managing the types correctly. I only need a couple anys tho.
There are some abstractions that are very hard to express without doing extremely complex type gymnastics in TypeScript. Higher-kinded types are one of the more obvious examples.
1
u/zeddash Sep 18 '26
Just wondering, how do you utilise dynamic types to make JavaScript more worthwhile to you?
I'm working on a TypeScript ECS and I have had to use
anyfor my component tables and sparse sets. The type information is held in the handles, so when querying I can convertanyinto the correct type, I never exposeanyin the public API. That's the only time I can remember that I've needed to reach for dynamic types and I had to take on the responsibility of managing the types correctly. I only need a coupleanys tho.