0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier #158

Closed faergeek closed 1 year ago

faergeek commented 1 year ago

Describe the bug

Hello! First of all, thanks for the great library 👍 It's very cool!

But now I'm trying to update wonka from 6.2.5 to 6.2.6 or 6.3.0 on one of my projects and typescript gives me the following error:

node_modules/wonka/dist/wonka.d.ts:9:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.

9 enum TalkbackKind {
  ~~~~

Found 1 error in node_modules/wonka/dist/wonka.d.ts:9

I tried to build it locally, but I installed deps using yarn instead of pnpm, so effectively all the latest, and it outputs declare for enums correctly. But on published version on npm there's no declare keywords before enums. So I assume it may be a problem with some of the dependencies.

I created a repo with simple reproduction, just in case. It has wonka@6.3.0 and gives an error. But if you change it to wonka@6.2.5, there will be no errors.

Reproduction

https://github.com/faergeek/wonka-tsc-issue-reproduction

Package version

wonka@6.2.6

Validations

kitten commented 1 year ago

Hiya :wave: Seems like I missed a declare keyword on the internal enums. Rest assured that this shouldn’t cause the library’s types to fail and if you enable skipLibCheck this will continue working as usual. However, I'll of course get a patch released ✌️

faergeek commented 1 year ago

Wow, that was quick, thanks a lot! 👍