Strings are only valid reducers when they start with $, but the error message is confusing when you try to resolve an invalid string:
dataPoint.resolve('invalid', {})
Unhandled rejection Error: Invalid reducer type. Could not find a matching reducer type while parsing the value:
'invalid'
Try using an Array, String, Object, or Function.
It's confusing because the input was as a string, but the error says "Try using a string."
Suggested solution:
Rephrase the error message to something like this:
Try using an Array, Object, Function, or String beginning with "$".
Problem description:
Strings are only valid reducers when they start with
$
, but the error message is confusing when you try to resolve an invalid string:It's confusing because the input was as a string, but the error says "Try using a string."
Suggested solution:
Rephrase the error message to something like this:
https://github.com/ViacomInc/data-point/blob/master/packages/data-point/lib/reducer-types/factory.js#L59
EDIT: we also use strings with the format
<entityType>:<entityId>