Closed pdawyndt closed 1 month ago
Are there any ideas on how to resolve this issue? As a use case, I would apply this for the exercise "Str8ts" which currently has two methods the now require to have String
keys instead of the (more logical) Number
keys.
A full solution would need two parts here I think:
Map
as the "map" type in JavaScript by default and add an advanced type for object
, which means more key types can be used.Then, we can support Map
with different types of keys in the test suite in addition to object
s.
I would agree with this solution. As far as I can judge, this does not seem to break anything (except for the fact that we may have to add some explicit types wherever we explicitly want to pass Object
arguments instead of Map
arguments).
One issue that came to mind for later: when TESTed supports map-item access, we need to take into account that the syntax is different for Map
and Object
in JavaScript.
Suggestion: Consider supporting maps with non-string keys in JavaScript as
Map
, whereObject
can only be used for maps with string keys.Rationale: JavaScript objects (
Object
) always have string keys. As a result, TESTed currently also supports maps with string keys in JavaScript. However, TESTed also supportsMap
as a representation of maps in JavaScript, and they can have non-string keys.