Skip to content

Commit 6a7a482

Browse files
Philipp GfellerEomm
Philipp Gfeller
authored andcommitted
fix: add user to FastifyRequest typings (#74) (#75)
* fix: add user to FastifyRequest typings (#74) * tests: add test for user type on request
1 parent 415f8ae commit 6a7a482

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ declare module 'fastify' {
5555
options: jwt.VerifyOptions,
5656
callback: JWTTypes.VerifyCallback<Decoded>,
5757
): void;
58+
user: JWTTypes.SignPayloadType;
5859
}
5960
}
6061

type.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ app.post('/signup', async (req, reply) =>
4040
{
4141
const token = app.jwt.sign({ user: "userName" });
4242
let data = await app.jwt.verify(token);
43+
const user = req.user;
4344
reply.send({ token });
4445
});

0 commit comments

Comments
 (0)