Why is `ComponentTypes` plural?
Opened this issue · 4 comments
It would make more sense if we made it singular, as that's more idiomatic for that kind of type in general.
Yes probably, though I use it regularly (eg. to type an array holding various component types) so changing it would break existing code. We could add an alias...
@spacejack I'm aware it's breaking and that (Edit: using an alias) was the intent.
Well TBH "ComponentTypes" doesn't read too badly when used to identify an array holding different component types. Autocomplete may be a bit annoying with two options. It might have been better to have a POJOComponent
type and then Component
could be the union of all component types. So I guess I don't feel strongly enough in favour to actually change it.
@spacejack That's true, but you most often see this used in stuff like someAttr: ComponentTypes<...>
, where it ends up looking weird. Arrays of components ends up Array<ComponentTypes<...>>
, and ComponentTypes<...>
still reads as singular there, too - you normally read Array<number>
as "an array of numbers", not "an array of number".
I personally don't feel too strongly about this, but I'd like to see it fixed eventually.