Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Why is ComponentTypes plural? #42

Open
dead-claudia opened this issue Oct 24, 2019 · 4 comments
Open

Why is ComponentTypes plural? #42

dead-claudia opened this issue Oct 24, 2019 · 4 comments

Comments

@dead-claudia
Copy link
Member

It would make more sense if we made it singular, as that's more idiomatic for that kind of type in general.

@spacejack
Copy link
Collaborator

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...

@dead-claudia
Copy link
Member Author

dead-claudia commented Oct 26, 2019

@spacejack I'm aware it's breaking and that (Edit: using an alias) was the intent.

@spacejack
Copy link
Collaborator

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.

@dead-claudia
Copy link
Member Author

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants