Description
Is your feature request related to a problem? Please describe.
I'm using Decimal.js in zod schemas. When I use the superForm with dataType='json', posting data fails during devalue.stringify, because it cannot serialize custom type "Decimal".
Describe the solution you'd like
Feature request: provide possibility to pass reducers/revivers to superForm/superValidate to parse the request data accordingly.
Describe alternatives you've considered
async onSubmit(input) {
// Reduce custom types before submitting
const formData = await superFormResult.validateForm();
if (formData.valid) {
const formJsonData = JSON.parse(JSON.stringify(formData.data));
input.jsonData(formJsonData);
}
},
I also tried to fork and npm-link the devalue package for sveltekit (to provide default reducers/revivers for sveltekit), but superforms is using 4.3.3 and sveltekit 5.0.0 (which may still be different in the future). Even if I "override" the dependency to use 5.0.0, this one instantiated in a different (memory) context and default reducers/revivers working for sveltekit are empty for superforms - so "no go".
Additional context
None