Skip to content

Conversation

@JAD3N
Copy link
Contributor

@JAD3N JAD3N commented Jan 19, 2026

The import needs to be treated as a value, not a type as a type cannot be instantiated.

@JAD3N JAD3N marked this pull request as draft January 19, 2026 11:28
@JAD3N
Copy link
Contributor Author

JAD3N commented Jan 19, 2026

There are still issues with the typings so I've converted this to a draft.

@JAD3N
Copy link
Contributor Author

JAD3N commented Jan 19, 2026

I've adjusted the typings and it seems to be working on my projects now after applying the changes.

@JAD3N JAD3N marked this pull request as ready for review January 19, 2026 11:38
@lpinca
Copy link
Member

lpinca commented Jan 19, 2026

cc @EzraBrooks

@lpinca
Copy link
Member

lpinca commented Jan 19, 2026

This duplicates everything, does it work with just import { EventEmitter } from "./index.d.ts"; in index.d.mts.

@JAD3N
Copy link
Contributor Author

JAD3N commented Jan 19, 2026

This duplicates everything, does it work with just import { EventEmitter } from "./index.d.ts"; in index.d.mts.

I tried to do that, but I also encountered an issue with that mentioned here: #281 (comment)
TS2306: File '.../node_modules/eventemitter3/index.d.ts' is not a module.

@lpinca
Copy link
Member

lpinca commented Jan 19, 2026

Ok, then I think I will just revert #279.

@JAD3N
Copy link
Contributor Author

JAD3N commented Jan 19, 2026

@lpinca I've made a few changes and it seems to be compliant with the tool specified in #279 and doesn't duplicate the type definitions.

@JAD3N
Copy link
Contributor Author

JAD3N commented Jan 19, 2026

I've tweaked some things to add better compatibility with older TypeScript versions and removed the duplicated typings by adding a shared types file.

Screenshot 2026-01-19 at 12 37 31

The type checking tool also gave all green, after checking via importing via CJS and ESM I don't see any issues. This PR looks good to me, if there are any needed changes please let me know!

@lpinca lpinca merged commit 7ec84d9 into primus:master Jan 19, 2026
2 checks passed
@JAD3N JAD3N deleted the fix-mts-typing branch January 19, 2026 13:39
@lpinca
Copy link
Member

lpinca commented Jan 19, 2026

Thank you.

lpinca added a commit that referenced this pull request Jan 19, 2026
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