How to make Dynamic index in generic typing?

I’ve been trying to code a custom generic typing index system for my skill system, it would work like this

Each skill has a Name value, and every skill group can store skills
my plan was to use generic typing to add the names to a group, well, it doesn’t really work.

I CAN do something like CreateGroup<T...>(...:T...): T, but based on my experiments, it either don’t work or only uses the number index, not name index.
I want to be able to extract the name value from the skill, and use that as the index on the typechecking, is there any way I can do that?

bump, still didn’t figure out how to do it!

Do you really want to use generics?
They kind of suck, especially in functions.

Also, I don’t really understand the point of the function you wrote. It returns itself?What?Why?
If you are using strict type checks, then you should make static types and NOT “vibe code” to keep the type checker shut hostage.

1 Like