@@ -4,7 +4,7 @@ import helmet, { contentSecurityPolicy, HelmetOptions } from 'helmet';
44declare module 'fastify' {
55 export interface RouteShorthandOptions <
66 RawServer extends RawServerBase = RawServerDefault
7- > extends FastifyHelmetRouteOptions { }
7+ > extends fastifyHelmet . FastifyHelmetRouteOptions { }
88
99 interface FastifyReply {
1010 cspNonce : {
@@ -14,20 +14,27 @@ declare module 'fastify' {
1414 helmet : ( opts ?: HelmetOptions ) => typeof helmet
1515 }
1616
17- export interface RouteOptions extends FastifyHelmetRouteOptions { }
17+ export interface RouteOptions extends fastifyHelmet . FastifyHelmetRouteOptions { }
1818}
1919
20- export interface FastifyHelmetRouteOptions {
21- helmet ?: Omit < FastifyHelmetOptions , 'global' > | false ;
22- }
23-
24- export interface FastifyHelmetOptions extends NonNullable < HelmetOptions > {
25- enableCSPNonces ?: boolean ,
26- global ?: boolean ;
27- }
28-
29- export const fastifyHelmet : FastifyPluginAsync < FastifyHelmetOptions > & {
20+ type FastifyHelmet = FastifyPluginAsync < fastifyHelmet . FastifyHelmetOptions > & {
3021 contentSecurityPolicy : typeof contentSecurityPolicy ;
3122} ;
3223
33- export default fastifyHelmet ;
24+ declare namespace fastifyHelmet {
25+
26+ export interface FastifyHelmetRouteOptions {
27+ helmet ?: Omit < FastifyHelmetOptions , 'global' > | false ;
28+ }
29+
30+ export interface FastifyHelmetOptions extends NonNullable < HelmetOptions > {
31+ enableCSPNonces ?: boolean ,
32+ global ?: boolean ;
33+ }
34+
35+ export const fastifyHelmet : FastifyHelmet
36+ export { fastifyHelmet as default }
37+ }
38+
39+ declare function fastifyHelmet ( ...params : Parameters < FastifyHelmet > ) : ReturnType < FastifyHelmet >
40+ export = fastifyHelmet
0 commit comments