Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export FastifyZodInstance directly #38

Open
lucaskbr opened this issue Feb 25, 2023 · 1 comment
Open

export FastifyZodInstance directly #38

lucaskbr opened this issue Feb 25, 2023 · 1 comment

Comments

@lucaskbr
Copy link

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 the index.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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants