Skip to content

consumer.fetch() return type is not properly exported #345

@shadone

Description

@shadone

Observed behavior

When calling consumer.fetch() the returned value becomes of any type.

I see that the consumer.fetch() is defined to return Promise<ConsumerMessages> in jetstream/src/types.ts and ConsumerMessage is defined as QueuedIterator<JsMsg>

export type ExportedConsumer = ConsumerKind & {
    fetch(opts?: FetchOptions): Promise<ConsumerMessages>;
};

export type ConsumerMessages = QueuedIterator<JsMsg> & Close & {
    status(): AsyncIterable<ConsumerNotification>;
};

However when importing @nats-io/jetstream in my code, the return value of consumer.fetch() gets erased to any, see attached screenshots from my IDE

Image Image

Expected behavior

The return value of consumer.fetch() should be "ConsumerMessages"

Server and client version

@nats-io/jetstream version 3.2.0

Host environment

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions