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

types: export FastifyHelmetOptions to TypeScript users #165

Merged
merged 2 commits into from
Jan 9, 2022

Conversation

sniperwolf
Copy link
Contributor

Checklist

@coveralls
Copy link

coveralls commented Jan 8, 2022

Pull Request Test Coverage Report for Build 1672290443

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1598031313: 0.0%
Covered Lines: 26
Relevant Lines: 26

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1671986596

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1598031313: 0.0%
Covered Lines: 26
Relevant Lines: 26

💛 - Coveralls

@darkgl0w darkgl0w changed the title chore: export FastifyHelmetOptions to TypeScript users types: export FastifyHelmetOptions to TypeScript users Jan 8, 2022
Copy link
Member

@darkgl0w darkgl0w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution ^_^
Can you please add a test inside the index.test-d.ts file ?

@sniperwolf
Copy link
Contributor Author

@darkgl0w Something like the following make sense as a test to prove that fastify-helmet instance is using the 
FastifyHelmetOptions options?

expectType<FastifyPluginCallback<FastifyHelmetOptions> & {
    contentSecurityPolicy: typeof helmet.contentSecurityPolicy;
}>(fastifyHelmet);

@darkgl0w
Copy link
Member

darkgl0w commented Jan 8, 2022

Yes something like this should be enough.

Seen that we export FastifyHelmetOptions we can do something like this too :

const helmetOptions = {
  contentSecurityPolicy: false,
  dnsPrefetchControl: false,
  expectCt: false,
  frameguard: false,
  hidePoweredBy: false,
  hsts: false,
  ieNoOpen: false,
  noSniff: false,
  permittedCrossDomainPolicies: false,
  referrerPolicy: false,
  xssFilter: false
}

// or maybe: expectAssignable<FastifyHelmetOptions>(helmetOptions);
expectType<FastifyHelmetOptions>(helmetOptions);

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a unit test?

Copy link
Member

@darkgl0w darkgl0w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Fdawgs Fdawgs merged commit 186fba4 into fastify:master Jan 9, 2022
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

Successfully merging this pull request may close these issues.

5 participants