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.

TS2309: An export assignment cannot be used in a module with other exported elements.

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 7.0.4
  • Platform / OS version: Windows 10
  • Node.js version: v14.15.4

What steps will reproduce the problem? This started happening after updating from 7.0.1 to 7.0.4 1. tsconfig.json:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "outDir": "dist",
    "sourceMap": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true
  }
}

main.ts:

import puppeteer from 'puppeteer';

(async () => {
  puppeteer.launch();
})();

  1. run
tsc -p tsconfig.json

What is the expected result? Project should compile

What happens instead?

node_modules/puppeteer/lib/types.d.ts:24385:1 - error TS2309: An export assignment cannot be used in a module with other exported elements.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:26
  • Comments:5

github_iconTop GitHub Comments

4reactions
jackfranklincommented, Feb 12, 2021

Hey all,

I have learned a lot about shipping TS this week and we think v7.1.0 which shipped today fixes this. It no longer uses export = or export default in an attempt to be compat with your environment, regardless of if it’s ESM or CJS that you’re working with.

We also now automatically test our TS types against a tonne of environments: https://github.com/puppeteer/puppeteer/tree/main/test-ts-types, some use ESM, some CJS, etc, to try to avoid issues like this in the future.

I’m going to close this as I think 7.1.0 fixes it, but please open issues if you have problems, and I’m sorry for the churn and problems we’ve hit so far on this.

1reaction
tdodgehdaicommented, Feb 10, 2021

I’m having this issue too. Using @SimonHessel 's fix for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript error "An export assignment cannot be used in a ...
TS2309: An export assignment cannot be used in a module with other exported elements. However, if you declare a declare a namespace with...
Read more >
Microsoft/TypeScript - Gitter
Since I'm using export = , I can't re-export interfaces. I got TS2309: An export assignment cannot be used in a module with...
Read more >
How To Use Modules in TypeScript | DigitalOcean
ts:1:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module ...
Read more >
nv-jsparser-helper - npm
There is 1 other project in the npm registry using nv-jsparser-helper. ... literal cannot be used as an exported binding without `from`.
Read more >
TypeScript export CommonJS and ES Modules
tsc index.ts index.ts:3:1 - error TS2309: An export assignment cannot be used in a module with other exported elements. 3 export = myModule ......
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