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
Helmet 6.1.2: Type 'typeof import("/srv/www/cz.vegilove.api/node_modules/helmet/index")' has no call signatures. #414
Comments
In the short term, you can fix this by installing What does your |
Having the same error with v6.1.2 My tsconfig: {
"compilerOptions": {
"target": "ESNext",
"module": "Node16",
"moduleResolution":"Node16",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"sourceMap": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true,
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"#api/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts"]
} |
I made the following app and could not reproduce your issue:
|
I just published |
Typescript v5.0.4 |
Just tried with v6.1.3 still same issue unfortunately. I'll setup a repro. |
@EvanHahn OK from what I've seem the problem is repro: https://github.com/rafaelpimpa/helmet-issue-414 I think it's easily fixable with "exports" key in package.json: https://nodejs.org/api/packages.html#main-entry-point-export |
@rafaelpimpa Thanks, this is very helpful. I'll deploy a fix ASAP. |
This should be fixed in |
I also have still the problem. When launched using ts-node with some specail params, i can use it in dev, but to build production code with tsc (typescript 5.0.4), will fail with error:
My tsconfig looks like: And i am using esm ("type":"module" in package.json). |
@rostalevicek Sorry about this. Let's move discussion to #419. |
Leads to error:
error TS2349: This expression is not callable.
Type 'typeof import("/srv/www/cz.vegilove.api/node_modules/helmet/index")' has no call signatures.
app.use( helmet() )
The probelm is default export. It exports the object of named functions, therefore it is possible to use helmet.xxxx() but it does not include "function helmet()".
One possible solution is to include "helmet" in named exports... i guess
The text was updated successfully, but these errors were encountered: