-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type check failed when register the plugin #216
Comments
Duplicate of #210 I also provided a PR in upstream helmet project. So it is a helmet issue. |
@Uzlopak would you pls update the dependency since the upstream is updated? |
I've tried overriding |
I don't understand why but TypeScript (v4.9.5) is happy when I change the --- a/node_modules/@fastify/helmet/types/index.d.ts
+++ b/node_modules/@fastify/helmet/types/index.d.ts
@@ -27,9 +27,9 @@ declare namespace fastifyHelmet {
helmet?: Omit<FastifyHelmetOptions, 'global'> | false;
}
- export interface FastifyHelmetOptions extends NonNullable<HelmetOptions> {
+ export type FastifyHelmetOptions = NonNullable<HelmetOptions> & {
enableCSPNonces?: boolean,
global?: boolean;
}
export const fastifyHelmet: FastifyHelmet I couldn't reprouce this behaviour with the TS Playground though: Maybe that helps someone. |
We actually fixed this upstream in helmet?! Do you still experience this issue with latest version of fastify-helmet? |
Yes, we still have that problem. And we are on the latest version of fastify-helmet but not on the latest version of helmet though as that is limited by fastify-helmet: Line 49 in fe038ce
Btw, do you have a link to the fix for me? |
@fastify/helmet is actually supporting all version 6. And if you make a |
Yes, we are on v6.2.0 and the error is also different. await fastify.register(helmet, {
contentSecurityPolicy: false,
crossOriginEmbedderPolicy: false,
crossOriginOpenerPolicy: false,
crossOriginResourcePolicy: false,
});
But I could create a new issue for this. |
Hmm. Maybe, because of fastify-helmet/types/index.d.ts Line 21 in fe038ce
Maybe should be: type FastifyHelmet = FastifyPluginAsync<fastifyHelmet.FastifyHelmetOptions & {
contentSecurityPolicy: typeof contentSecurityPolicy;
}>; |
Please create a new issue and a repo where you provide a minimal reproducable example of the issue you experience. |
Prerequisites
Fastify version
4.14.1
Plugin version
10.1.0
Node.js version
v18.12.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04.2
Description
Steps to Reproduce
https://docs.nestjs.com/security/helmet#use-with-fastify
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: