New API syntaxic sugar
About the brand new stronger type checking going with the new API, I think it might be interesting to
- have named functions for
throwTypeError('Immutable.Map', map, 'map'); => throwImmutableMapTypeError(map)
throwTypeError('PositionRecord', position, 'position', 'Position'); => throwPositionTypeError(position)
etc
-
about the use of that function, we can try to be consistent about throwing for early exit for both portType checking and string type checking of the key eg to improve: https://github.com/Talend/react-flow-designer/blob/91bd0b6a2f7de581155883ef461a4cd6e16634e8/src/api/port/port.js#L112
-
throwInDev will require a UT to explicit that it can take either a string or a new TypeError(..)
those enhancement might help us to have concise and stronger code :)
There is no duplicate use of a throwTypeError in the code base, yet it is now possible to create such function via partial application of throwTypeError