[JS] Add fromObject
method to take an AsObject type and return a T.
#11
Labels
fromObject
method to take an AsObject type and return a T.
#11
What language does this apply to?
JS/TS
Describe the problem you are trying to solve.
In JS, many different libraries expect to work with dictionaries, basically
Record<A, B>
or lists of these, to do things like state management in single page apps, list operations like find, slice, zip, etc. and more. Having the ability to freely move between a Message and a JSON object would make it MUCH easier to interoperate with different tools.Currently, my message types get compiled to something like the following:
Describe the solution you'd like
Describe alternatives you've considered
Writing a generic function to parse the field descriptors, but I don't know enough to make it work correctly, PLUS, it seems like a much better thing to be provided out of the box.
Additional context
The text was updated successfully, but these errors were encountered: