Calls jsonAsType using the provided constructor as the factory method. Consider, for example, a class Item with two constructor parameters of type string and number respectively. Then we can use
Item
string
number
const item = jsonAsInstance( data, [jsonStringGetter('name'), jsonNumberGetter('count')], Item); Copy
const item = jsonAsInstance( data, [jsonStringGetter('name'), jsonNumberGetter('count')], Item);
to safely pick fields name and count respectively from data and call the constructor of Item.
name
count
data
Calls jsonAsType using the provided constructor as the factory method. Consider, for example, a class
Itemwith two constructor parameters of typestringandnumberrespectively. Then we can useto safely pick fields
nameandcountrespectively fromdataand call the constructor ofItem.