Skip to content

fix: fix type error with moduleResolution node16 #333

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

Merged

Conversation

Hoishin
Copy link
Contributor

@Hoishin Hoishin commented Jun 26, 2023

Related Issue (if applicable):

Description:

With "moduleResolution": "node16" set, users of this library receives incorrect OBSWebsocket type because internally the eventemitter3 import fails.

@@ -49,7 +49,7 @@
"scripts": {
"build": "npm-run-all clean build:*",
"build:bundle": "microbundle -f modern,esm,cjs --no-compress src/{json,msgpack}.ts --generateTypes false",
"build:types": "tsc --emitDeclarationOnly",
"build:types": "tsc --emitDeclarationOnly && tsc --noEmit --moduleResolution bundler",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also makes sure types are correct under moduleResolution: bundler

@@ -1,5 +1,5 @@
import createDebug from 'debug';
import EventEmitter from 'eventemitter3';
import {EventEmitter} from 'eventemitter3';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-06-26 at 22 40 50

eventemitter3 exports EventEmitter with both named and root exports, but it confuses TypeScript because the default export is a namespace mixed with classes.

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.

2 participants