Closed
Description
https://webidl.spec.whatwg.org/#dfn-distinguishable
It isn't clear to me why callbacks and dictionaries can't be distinguished.
I'm designing an API like:
whatever(callback);
But there's a strong possibility that options will be added in future, and I want to avoid this pattern:
whatever(() => {
// Quite
// a
// bit
// of
// code
}, { behaveDifferently: true });
And instead go for:
whatever({
behaveDifferently: true,
callback() {
// Quite
// a
// bit
// of
// code
}
});
But it seems like I can't overload from whatever(callback)
to whatever({ callback })
.
I would have assumed that an argument could be treated as a callback if it's callable.
Metadata
Metadata
Assignees
Labels
No labels