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).
/**
* An EntitySelector determines which entities will be affected.
* Can be one of the following:
* - a single ID in form of a string
* - multiple IDs in form of an array of strings
* - a predicate function that returns `true` for entities to be selected
*/
export declare type EntitySelector<T> = string | string[] | ((entity: T) => boolean);
It would be great if the restrictions could be just a little bit relaxed by extending such types to numbers.
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.