Skip to content

TypeScript: how to import the NoticeMessage type? #2763

@cakoose

Description

@cakoose

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions