Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error when sending Readable to reply.send #108

Open
2 tasks done
theguacamoleking opened this issue Dec 16, 2024 · 0 comments
Open
2 tasks done

Type error when sending Readable to reply.send #108

theguacamoleking opened this issue Dec 16, 2024 · 0 comments

Comments

@theguacamoleking
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant