question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with TypeScript imports in 4.0.0

See original GitHub issue

Code like below overrides the exported object, which causes default being missing from every module.

module.exports = contentSecurityPolicy;
export default contentSecurityPolicy;

For example, inside index.ts, add console.log("wat", expectCt); under the import, and we’ll see it’s undefined.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
sehropecommented, Aug 14, 2020

+1 for helmet@4.1.0-rc.2. Typing issues are resolved.

For anybody that was previously importing the HelmetOptions interface, e.g. you’re assigning the options to a variable rather than directly invoking the middleware function, you can do it by extracting the type from the middleware arg:

import helmet = require('helmet');
const opts: Parameters<typeof helmet>[0] = {
    // strongly typed helmet options go here...
};
helmet(opts);
4reactions
EvanHahncommented, Aug 12, 2020

This should be fixed in the next version. Please try it out with npm install helmet@4.1.0-rc.2 and let me know what you think. Once I get a few successful reports, I’ll release it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 4.0
One specific issue that we heard from users was that auto-imports didn't work on dependencies that were written in TypeScript - that is,...
Read more >
Announcing TypeScript 4.0 - Microsoft Developer Blogs
One specific issue that we heard from users was that auto-imports didn't work on dependencies that were written in TypeScript – that is,...
Read more >
2 ESM interoperability issue with Node + Typescript + Webpack
For anybody facing with the same problem, I am using node: ... esm1: webpack.config.js import path from 'path'; import {fileURLToPath} from ...
Read more >
TypeScript support in Svelte - Learn web development
Note: The Svelte template uses svelte-preprocess 4.0.0 to support TypeScript. From that version onward you have to use export / import type ...
Read more >
Migrating to AWS CDK v2 - AWS Documentation - Amazon.com
Troubleshooting. TypeScript 'from' expected or ';' expected error in imports. Upgrade to TypeScript 3.8 or later. Run 'cdk bootstrap ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found