TypedJSON icon indicating copy to clipboard operation
TypedJSON copied to clipboard

typeResolver setting example

Open mustafaekim opened this issue 9 years ago • 3 comments

Hi,

Can you please provide an example for using typeResolver? (Typescript please)

Thanks

mustafaekim avatar Dec 08 '16 01:12 mustafaekim

Hi, @mustafaekim

This is not yet in TypedJSON, as it is currently undergoing a complete rewrite. Once implemented though, the setting will require a callback function accepting the source Object being deserialized, the Map of known-type constructors, as well as the constructor of the expected type. It will be expected to return one of the elements from the Map of known-types, or any other constructor that is deemed the correct one.

JohnWeisz avatar Dec 19 '16 14:12 JohnWeisz

OK thanks for the support. I changed the variable name to __type and I move on

mustafaekim avatar Dec 19 '16 14:12 mustafaekim

There is an example here now : https://github.com/JohnWeisz/TypedJSON/issues/88#issuecomment-454334197

mullerch avatar Jul 23 '20 08:07 mullerch