diff --git a/bin/fastify-schema-to-typescript.js b/bin/fastify-schema-to-typescript.js index ceddecb..83fa3be 100644 --- a/bin/fastify-schema-to-typescript.js +++ b/bin/fastify-schema-to-typescript.js @@ -38,8 +38,18 @@ program "file extension to use for generated files", parseExtension, ".ts" + ) + .option( + "-m, --module ", + "module to import the RouteHandler type from", + "fastify" ); program.parse(process.argv); -convert({ glob: program.glob, prefix: program.prefix, ext: program.ext }); +convert({ + glob: program.glob, + prefix: program.prefix, + ext: program.ext, + module: program.module, +}); diff --git a/src/index.ts b/src/index.ts index 2f788a4..8def18c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ export interface Options { glob: string; prefix: string; ext: string; + module: string; } export async function generateReplyInterfaces( @@ -49,7 +50,7 @@ async function generateInterfaces( * Instead, modify the corresponding JSONSchema file and regenerate the types. */ -import { RouteHandler } from "fastify" +import { RouteHandler } from "${options.module}" import schema from './${parsedPath.base}'