objection.js
objection.js copied to clipboard
Fix typings for insert to accept model data interface
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.
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