Skip to content

Flexible send() return type #6

@raibis

Description

@raibis

Hi,

I would like to use your abstract class from
https://github.com/starfederation/datastar-typescript/blob/main/src/abstractServerSentEventGenerator.ts

for my package https://www.npmjs.com/package/nestjs-datastar

Unfortunately, this is not possible because the send() method has a hard-coded return type of string[].

Could you please update the abstract class slightly by using generics, like this:

// ...
export abstract class ServerSentEventGenerator<T = string[]> {
// ...

  protected send(
    event: EventType,
    dataLines: string[],
    options: DatastarEventOptions,
  ): T {

This way, the return type of the send() method would be flexible.

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