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

Uses import = require to import helmet types #96

Merged
merged 4 commits into from
Sep 15, 2020
Merged

Conversation

fox1t
Copy link
Member

@fox1t fox1t commented Sep 15, 2020

Fixes #95 (comment)

Since helmet is using export = the only way to make it work reliably with esModuleInterop: true AND false is to use import = require. This kind of import will tell TS that we are importing a module.exports namespace that could be callable: in fact now TS follows the ESM spec and makes namespaces non-callable by default.

Side note: we need to test our typings, for all our plugins and fastify itself, against all possible combinations of TS configurations to prevent these issues in the future.

Checklist

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.

lgtm

@mcollina mcollina merged commit e8812fb into fastify:master Sep 15, 2020
@gtolarc
Copy link

gtolarc commented Sep 16, 2020

v5.0.2 certainly does not work in projects with esModuleInterop: true. So it'd better release this on npm as soon as possible:) @mcollina

@fox1t
Copy link
Member Author

fox1t commented Sep 16, 2020

@gtolarc I am going to realease the patch.

@fox1t
Copy link
Member Author

fox1t commented Sep 16, 2020

v5.0.3 Released

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