mobxjs / serializr

Serialize and deserialize complex object graphs to and from JSON and Javascript classes
MIT License
766 stars 52 forks source link

How to serialise class MyClass { [key:string]: string[]} with dynamic observable fields #111

Closed Babazon closed 4 years ago

Babazon commented 4 years ago

How do I serialise and deserialise arrays (string) with optional keys? class MyClass { [key:string]: string[]}

I create observables in runtime when I receive backend response. But when I decorate it: @serializible(object(MyClass)) @observable public myModel?: MyClass I get

Error: [serializr] expected modelSchema, got undefined

I have tried custom serialisers and such that I've run into on SO, but no luck so far.