Magic for types to short-circuit `isPlainObject` checks
brettz9 opened this issue · comments
For the one last item not under the user's control, I believe we ought to add magic for types to short-circuit our internal use of isPlainObject
, e.g., so that, when special properties have been added via the likes of Object.defineProperty
, a "plain" object can be treated as a special one.
This short-circuiting might be as simple as defining a boolean like isPlainObject: true
on the type (this would also fit into dfahlander/typeson#1 ) so its tester (which I think would be a bit better renamed to detector
, btw, if that's ok) could ensure a match avoided the normal object cloning routine.
I think such a boolean would be superior to forcing the user to have to pass config to achieve this effect as a boolean would avoid breaking modularity.
Sorry again, meant for this to be on Typeson repo.