-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
featureNew functionality or improvementNew functionality or improvement
Description
Runtime
NodeJS
Runtime version
22.7.0
Module version
21.3.10
Used with
hapi application
Any other relevant information
No response
What problem are you trying to solve?
I'm trying to write a plugin that accepts a function that receives the request as a param and it could be nice to have the generic from the route shared to plugins, something like the following:
// plugin.d.ts
interface PluginSpecificConfiguration<Refs extends ReqRef = ReqRefDefaults> {}
// routes.d.ts
interface CommonRouteProperties<Refs extends ReqRef = ReqRefDefaults> {
plugins?: PluginSpecificConfiguration<Refs> | undefined;
}
With that, we could configure plugins like this
declare module '@hapi/hapi {
interface PluginSpecificConfiguration<Refs extends ReqRef = ReqRefDefaults> {
pluginName: PluginInterface<Refs>;
}
}
I'm interested in writting a PR if y'all accept the idea :)
Do you have a new or modified API suggestion to solve the problem?
No response
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement