Skip to content

Type error when sending Readable to reply.send #108

@theguacamoleking

Description

@theguacamoleking

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5

Plugin version

4.0.1

Node.js version

20

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

n/a

Description

The following schema

{
  schema: {
    // ...
    response: {
      200: {
        type: 'string',
        headers: {
          'Content-Type': { type: 'application/octet-stream', default: 'text/csv' },
        },
      },
    },
  },
}

Leads to reply.send being typed as (payload: string | undefined) => ....

This is problematic because sending streams leads to a type error

Argument of type Readable is not assignable to parameter of type string.

Link to code that reproduces the bug

No response

Expected Behavior

reply.send(someReadable) does not lead to a type error

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