objection.js icon indicating copy to clipboard operation
objection.js copied to clipboard

Fix typings for insert to accept model data interface

Open IlyaSemenov opened this issue 3 years ago • 1 comments

I don't think #2190 has been given enough attention. Granted, the title was misleading, but it included a particular use case which was failing.

Even though objection.js documentation doesn't cover separation of model classes and model data interfaces, I don't believe this is an edge case which doesn't deserve any support.

This PR fixes the typings for plain insert (not insertGraph) to accept model data interfaces and adds the regression test.

IlyaSemenov avatar Jan 27 '22 11:01 IlyaSemenov

Is there any reason this shouldn't be merged? I don't see the point of having a PartialModelObject that has ModelObjects as fields. Or if you do then at least provide another type eg PartialModelRecursiveObject or something

najibghadri avatar Apr 18 '23 13:04 najibghadri