node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

TypeScript: how to import the `NoticeMessage` type?

Open cakoose opened this issue 3 years ago • 1 comments

I'm using the "pg" package in my TypeScript program. I'm using .on('notice', ...) to listen for notices:

client.on('notice', (notice: NoticeMessage) => ...);

What's the right way to import NoticeMessage? It looks like it's not explicitly exported from pg-protocol: pg-protocol/src/index.ts.

This seems to work:

import {NoticeMessage} from 'pg-protocol/dist/messages';

But peeking into the "dist" subfolder feels brittle.

cakoose avatar Jun 22 '22 08:06 cakoose

None of the message types are exported from the main index.ts. It would be nice to have these officially exported.

mike-ayres avatar Jun 20 '24 02:06 mike-ayres