Open brogine opened 2 years ago
Hey, @brogine. Thanks for your kind words!
Dynamic object property support is not currently present. Moreover, I can't say for certain how it would align with the current API. If you have some proposals on this, I'd be glad to support you in making this happen. But if this support implies rewriting the library, I'd recommend against it, as I'm in a middle of such a rewrite already (that's been going on for quite some time but it's destined to land eventually).
I have this same issue.
Basically I have a field on a model that is an array of objects that can be one of 2 types.
But there is no way in mswjs/data to model an object that can have variable properties.
Any updates on this? I have a Record<string, string>
type that wants to be mocked. :)
Hi everyone!
First of all, thanks a lot for this project. It was the missing feature that MSW was lacking. So far I've found it easy to use and extremely simple to setup.
Let me describe the issue that I'm facing at the moment. I was not able to find a way to describe an estructure with dynamic object keys. Let's say I've this in TS:
Is there a way to do it? I tried adding
Object
as a type, but when I create elements, they are created as an empty object. Please, let me know if this is a missing feature. I'll try to create a PR for it.