Skip to content
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 Errors in node_modules/koa-helmet/node_modules/helmet/dist/types/index #84

Closed
zvaehn opened this issue Mar 20, 2023 · 5 comments
Closed

Comments

@zvaehn
Copy link

zvaehn commented Mar 20, 2023

It seems that there are some type errors in the "koa-helmet.d.ts" file.

Package Version: 7.0.1
Node Version: v16.14.0
Npm Version: 9.1.1

  scriptSrcAttr?: KoahelmetCspDirectiveValue[];

should be written with a capital "H" -> KoaHelmetCspDirectiveValue

Screenshot 2023-03-20 at 18 35 21

@gpinto67
Copy link
Contributor

options types are resolving to never for all options, despite the fact that headers like hsts and other should take options for configuration.

image

image

@jraoult
Copy link

jraoult commented Mar 21, 2023

There are other issues with the definition file when using moduleResolution with NodeNext or Node16 although they are not relevant for this issue. The main issue is in koa-helmet.d.ts that somehow the following is not working anymore:

type HelmetOptions = Required<Parameters<typeof helmet>>[0];

and we can use instead:

type HelmetOptions = Required<Parameters<typeof helmet.default>>[0];

or even simpler:

type HelmetOptions = helmet.HelmetOptions;

and yeah, of course, there is also the case issue mentioned by @zvaehn for the particular case of scriptSrcAttr.

@julienw
Copy link

julienw commented Mar 24, 2023

I believe that last issue is what gives the error is not assignable to undefined.
It would be good to fix this. Anyone want to do a PR about this?

@heunghingwan
Copy link
Contributor

done. #87

@venables
Copy link
Owner

Sorry about this! Fixed in #87 and released in version 7.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants