turkerdev / fastify-type-provider-zod

MIT License
337 stars 21 forks source link

export FastifyZodInstance directly #38

Open lucaskbr opened 1 year ago

lucaskbr commented 1 year ago

I would like to use the type FastifyZodInstance without having to re-create the type again in my app

example:

import { FastifyZodInstance  } from 'fastify-type-provider-zod'

export const buildMyRoute = (
  fastify: FastifyZodInstance,
) =>
  fastify
  .get(resource, {

A good improvement would be to directly export the type from the lib, since is already created in theindex.test-d.ts file

I've tried to open a pr but is blocked The requested URL returned error: 403

In src/index.ts

import type {
  FastifyInstance,
  FastifyBaseLogger,
  FastifySchema,
  FastifySchemaCompiler,
  FastifyTypeProvider,
  RawReplyDefaultExpression,
  RawRequestDefaultExpression,
  RawServerDefault,
} from 'fastify';

export type FastifyZodInstance = FastifyInstance<
  RawServerDefault,
  RawRequestDefaultExpression,
  RawReplyDefaultExpression,
  FastifyBaseLogger,
  ZodTypeProvider
>;

In types/index.test-d.ts

import type { FastifyZodInstance, ZodTypeProvider } from '../src/index';

byteHulk commented 1 month ago

any progress on this issue? or any other way to resolve it?