mobxjs / serializr

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

Callback last argument #123

Open NaridaL opened 4 years ago

NaridaL commented 4 years ago

for deserialize and update

fixes #77

I'm not loving this, tbh... you always need to pass the custom arguments now. If you forget them, you won't get a compiler error, as callback is optional, and customArg is typed as any.

Converting to promises completely, as @alexggordon suggested in #77 is problematic too, as Promises always return asynchronously, and the fact that serializr returns synchronously if there are no async dependencies is great.

util.promisify offers a mechanism for a custom promisified function, by defining deserialize[util.promisify.custom] = function..., this would be a non-breaking change which would probably be better. TypeScript also correctly types the custom promisied function.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.02%) to 88.889% when pulling a1afa267a55f46a6fa3d2be0edf371e0de392c70 on callback-last-argument into 3738fe170e05185bde163e273da21f92bf9638a8 on master.