Describe the feature
Since Nitro generates some types for the response of routes, it would be great if it could also generate types for the input.
As an example:
// routes/index.ts
// This is just a normal eventhandler
export default defineEventHandler(async (event) => {
const { greet } = (await readBody(event)) satisfies Input;
return {
hello: greet,
};
});
// here comes the fun part:
export type Input = {
greet: string;
};
Nitro already generates the types for the response from the event handler:
// .nitro/types/nitro.d.ts
interface InternalApi {
'/': Awaited<ReturnType<typeof import('../../routes/index').default>>
}
With the types for the input this could look something like this:
interface InternalApi {
'/': Awaited<ReturnType<typeof import('../../routes/index').default>>
}
interface InternalApiInputs {
'/': import("../../routes/index").Input
}
Additional information
Describe the feature
Since Nitro generates some types for the response of routes, it would be great if it could also generate types for the input.
As an example:
Nitro already generates the types for the response from the event handler:
With the types for the input this could look something like this:
Additional information