mswjs / data

Data modeling and relation library for testing JavaScript applications.
https://npm.im/@mswjs/data
MIT License
829 stars 52 forks source link

isInternalEntity: Assert the value is an object #117

Closed kettanaito closed 3 years ago

kettanaito commented 3 years ago

GitHub

Changes

This prevents the isInternalEntity check to throw an exception when handling non-object types (still possible on runtime with the nested properties in model declarations).

TypeError: Cannot use 'in' operator to search for '__type' in "some value"
kettanaito commented 3 years ago

Hey, @gidesan. Please, would you have a minute to review this change? I believe we can use it in your pull request, as well as in #98. I feel this is a general bug fix we should introduce regardless of the features. Thanks.