DollarNavalex
04/09/2024, 11:30 AM/:id
, but can't figure out how to use both SessionRequest object and add my params type on it:
fastify.get("/:id", { preHandler: verifySession() }, async (request: SessionRequest<{ params: { id: int } }>, reply) => {
This doesn't work and typescript throw me a biiiig error explaining it can't accept this argument... Do you have any idea ?DollarNavalex
04/09/2024, 11:30 AMDollarNavalex
04/09/2024, 11:42 AMtypescript
interface ChallengeParams {
id: string
}
interface ChallengeRequest extends SessionRequest {
params: ChallengeParams
}
// ...
fastify.get<{ Params: ChallengeParams }>("/:id", { preHandler: verifySession() }, async (request: ChallengeRequest, reply) => {
DollarNavalex
04/09/2024, 11:43 AM