fastify / fastify/help

Extend FastifyRequest using FastifyPluginAsyncTypebox

Open
#830 1 comment 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
No language data
Stars
68
Forks
8
Avg merge
11h 2m
Merged PRs (30d)
2

Description

## 💬 Question here

Hey, i'm trying to extend FastifyRequest while using type-provider-typebox.

```ts
let fastify = Fastify(opts).withTypeProvider();

// then in another file
const route: FastifyPluginAsyncTypebox = async (instance, opts) => {
instance.register((request, reply) => {
request.user; // not defined
});

}
// maybe the solution is something like this but I'm not sure how:
// fastify.d.ts
declare module "fastify" {
export type FastifyNewRoute = FastifyPluginAsyncTypebox & {
instance: FastifyInstance... // now sure what to do next
};
}

````

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.