-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
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.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:
import fastify from 'fastify';
import {Type, TypeBoxTypeProvider} from '@fastify/type-provider-typebox';
const server = fastify().withTypeProvider<TypeBoxTypeProvider>();
server.get(
'/',
{
schema: {
response: {
200: Type.String(),
500: Type.Boolean(),
},
},
},
async (req, reply) => {
// this works as expected (payload type incorrect):
reply.status(200).send(false);
// but this doesn't error, passes silently
reply.status(300).send('asd');
}
);
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:
Arturs-E
Metadata
Metadata
Assignees
Labels
No labels