How do I add a property to a interface using declarations, without overwriting everything in this object.
declare module 'fastify' {
interface FastifyRequest {
user: User;
}
}
//auth.ts
...
const user = jwt.verify(
req.headers.authorization ?? '', // Property 'headers' does not exist on type 'FastifyRequest'.ts(2339)
...
I Found a solution:
Simply add a import with the module your declaring or add a triple slash reference like: