Optional properties inferred as { prop?: <type> | undefined }
Opened this issue · 0 comments
Hi, I recently started using Papr in one of my projects and so far I've been liking it a lot! But recently I came across an issue: the project is an API built with Fastify, and I use TypeBox as a validator, which infers optional properties as prop?: <type>
, whereas Papr infers optional properties as prop?: <type> | undefined
, this union type makes assigning a Papr document to a Fastify response schema when using TypeBox as a type provider impossible without extra work.
Is there a recommended way to handle something like this? The only two workarounds I've found is to define an optional property as a union with undefined at the validator level (allowing explicitly passing an undefined
as a value), which seems very hacky, and disabling ts-config's exactOptionalPropertyTypes
, which I guess is not too bad but still, if theres an option which doesn't involve touching the compiler's settings it would be perfect. Thanks in advance, and great work btw!