Skip to content

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.

"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.

@t2t2 t2t2 merged commit f458455 into obs-websocket-community-projects:master Jul 16, 2023
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