Update Dictionary#set
signature to take two arguments: key
and value
#4286
Labels
Dictionary#set
signature to take two arguments: key
and value
#4286
Problem
Currently our
Dictionary#add
method takes an object, like this:I see a couple of issues with this approach:
i. Construct an object before calling the method:
const values = {}; values[key] = value; dict.set(values);
i. Or use the less known square-bracket syntax:
dict.set({ [key]: value });
It is however nice that a user can assign multiple key-value pairs in a single method call.
Solution
I suggest migrating towards a more
Map
-like API:We should detect that the method is called with two arguments and provide this as an overload to the existing method.
How important is this improvement for you?
I'd like to see it, but have a workaround
The text was updated successfully, but these errors were encountered: