porsager / postgres

Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare
The Unlicense
7.03k stars 255 forks source link

fix(types): use correct default export #901

Open plushdohn opened 1 week ago

plushdohn commented 1 week ago

This PR fixes #862 by ensuring classes defined under the postgres namespace aren't also available as a named export, but only under the default postgres. export.

I've tested the change by patching the module in my projects, but I'm not sure if under some specific Typescript scenarios the behaviour could be incorrect.


Trying to import PostgresError as a named export:

Screenshot 2024-06-24 at 12 30 01

And here's the correct usage using the default export:

Screenshot 2024-06-24 at 12 31 14