Open tzarger opened 1 year ago
req.rvn will only be there if you enable it explicitly, meaning that we can't know whether you did or not. I think the current behavior is correct, and if you want to avoid typing issues you should just tell TS that in your route it is there using req.rvn!
In addition to what @simoneb said, you can always extend the FastifyRequest and remove the optional constraint
Hello,
I am seeing something that potentially could be error prone or at least when you think you have loaded or query, you may have a null error runtime
I see in your tests that you do something like:
await req.rvn?.store(test)
... and ...await req.rvn?.people?.store(person)
Is there any way to type that so we do not need to know if nullable or not? Even when using
const routeOptions = { rvn: { autoSession: true } };
it still shows as nullable.