-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Response status code being typed as any number
#208
Comments
Why should be only 200 or 500 be valid. It could be any positive integer number. |
Because the response is documented as: schema: {
response: {
200: Type.String(),
500: Type.Boolean(),
},
}, If the route had other possible return codes, I would have documented those. And since I haven't, those should be the only valid options. Which I'm obviously expecting the type checker to support, just like it does with the payload type. |
You make it look like a trivial change, which it possibly isnt. |
I have not said such thing, you are drawing conclusions.
I have no idea where you're coming from, I merely reported an issue on the project's GitHub issues page. That's what you're supposed to do when you face a bug in someone else's project. I have no time or interest in fixing the bug myself. |
Not a strong TS user here, but I tend to agree that the only status codes accepted should be the ones listed by the user. I can see only an issue, because in plain js you can define |
That is fine, but do not expect someone to pick it up unless they are also facing the same issue. The Fastify project is a community driven project. It is advanced by people working on the issues that draw their attention/needs. |
Prerequisites
Fastify version
5.1.0
Plugin version
5.1.0
Node.js version
22.13.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Fedora 41
Description
The following code doesn't error:
Expected Behavior
I would expect the
reply.status()
to be typed as(status: 200 | 500)
but it's just(status: number)
instead.My expected behavior is also how it works out-of-the-box in
fastify
as well:The text was updated successfully, but these errors were encountered: