Open aWeinzierl opened 4 years ago
I originally tried too type IDs as string | number
, but ran into other issues and decided to leave it as string
, since Object.keys
would also only return strings. But it's worth looking into it again as some things have changed since. PRs are also welcome.
I started working on this in the issue-227
branch.
I will have to see if the types will be consistent everywhere. For example the keys
StateSelector cannot be anything else but string[]
. So maybe a thing or two will be deprecated and/or replaced, but it looks promising.
As dictionaries with numbers are a lot faster, and I could not think of any advantages, I use numbers as keys.
However, entity-state seems to allow only strings as keys. For instance,
EntitySelector<T>
is restricted to string-types (except when you use a custom lambda).It would be great if the restrictions could be just a little bit relaxed by extending such types to numbers.