Revisit types exports declaration

This issue has been tracked since 2023-03-11.

Describe the bug

I recently submitted a PR that moved the types declaration to the top in all package.json export declarations. It turns out that the TypeScript documentation is incorrect about this one and it probably shouldn't come first if we want to support CJS targeting consumers that are using NodeNext module resolution.

Additional context
Twitter thread: https://twitter.com/AndaristRake/status/1634508804728451072
Previous pull request: 57b4e01

smaye81 wrote this answer on 2023-03-14

Can you clarify what the expected error would be or with what setup it should occur? We tried testing this with a CommonJS project we have in our Connect-ES Integration repo and it seems to work fine.

We tried NodeNext in both module and moduleResolution and the app seems to be build and run fine. Not sure if we're missing something in the test?

fubhy wrote this answer on 2023-03-14

I am not sure either tbh. but in that Twitter conversation it sounded like it wouldn't work under certain circumstances in a CJS context. So not sure what to do here. Just sit back and wait until someone complains in the future? Just wanted to bring this to your attention and was wondering if I had made a mistake with that change...

smaye81 wrote this answer on 2023-03-14

Yep, appreciate you calling it out. I'd be reticent to go back to what it was previously until we have a reason to do so. So, let's maybe close this issue and if it does surface as an issue, we can reopen?

fubhy wrote this answer on 2023-03-14

Yep. And if that happens in the future we now have a breadcrumb to the cause already :)

More Details About Repo
Owner Name bufbuild
Repo Name connect-es
Full Name bufbuild/connect-es
Language TypeScript
Created Date 2022-02-16
Updated Date 2023-03-24
Star Count 852
Watcher Count 20
Fork Count 33
Issue Count 17

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date