sinclairzx81 / fastify-typebox Goto Github PK
View Code? Open in Web Editor NEWEnhanced TypeBox support for Fastify
License: Other
Enhanced TypeBox support for Fastify
License: Other
Hi,
thanks a lot for your amazing project! I played a bit around and was wondering if it's possible to use the auto type inference also for an async handler function.
Here is a small example for what I would like to achieve:
server.get(
'/add',
{
schema: {
querystring: Type.Object({
a: Type.Number(),
b: Type.Number(),
}),
response: {
200: Type.Object({ hello: Type.Number() }),
},
},
},
async (req, reply) => {
return { hello2: 'test' }; // typescript should show an error, because {hello: 1} is expected
},
);
I've also tried to modify the typings, but didn't come too far, because of my lacking experience ;)
Currently, I think the most important missing part is re-mapping FastifyPluginAsync
and FastifyPluginCallback
.
There is no equivalent async function of FastifyTypeBoxPluginCallback
After some discussion in fastify/fastify#3391 (comment) decided to open this issue because still having the same/similar issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.