TS2309: An export assignment cannot be used in a module with other exported elements.
See original GitHub issueSteps 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();
})();
- 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:
- Created 3 years ago
- Reactions:26
- Comments:5
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 =orexport defaultin 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.
I’m having this issue too. Using @SimonHessel 's fix for now.