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

doc: type definition of FastifyRequest with TypeProvider #4

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

vitoladev
Copy link
Contributor

@vitoladev vitoladev commented Mar 19, 2022

Checklist

};

export const CreateProductHandler = (
req: FastifyRequestTypebox<typeof CreateProductSchema>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
req: FastifyRequestTypebox<typeof CreateProductSchema>
req: FastifyRequestTypebox<Static<typeof CreateProductSchema>>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I saw that it didn't work with the Static function because TypeboxProvider already does this internally, so it throws an error:
Type '{ body: TObject<{ name: TString; price: TNumber; }>; }' does not satisfy the constraint 'TSchema'. Property '$static' is missing in type '{ body: TObject<{ name: TString; price: TNumber; }>; }' but required in type 'TSchema'.ts(2344)

@RafaelGSS RafaelGSS merged commit 4703e77 into fastify:main Mar 21, 2022
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

Successfully merging this pull request may close these issues.

2 participants