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
Plugins must be imported at the top to propagate the types #4122
Comments
It is the problem of Please import the package on top. import FastifySwagger from '@fastify/swagger'
server.register(FastifySwagger) |
@climba03003 have we documented that on our docs? |
I can't find it even now. When I know what I'm looking for |
This would be a great addition to our docs! Would you like to send a PR? |
@mcollina sure. Do you think it should be in this repo or in fastify/swagger repo? |
this repo, in the typescript docs |
Yes, we do not have document anything on it. Are we necessary to document how TypeScript behave? |
@climba03003 I agree, but the docs should tackle also pitfalls. we of course don't need to elaborate on the matters but may at least put a reference or link to the relevant information. |
Prerequisites
Fastify version
3.29.1
Plugin version
6.1.0
Node.js version
16.15.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Debian 11.3
Description
typescript throw error when trying to add description or summary to endpoints:
This is supported according to
@fastify/swagger
:Also, if I'm ignore the error with
// @ts-ignore
it's working correctly and the swagger is validSteps to Reproduce
Almost identical to
@fastify/swagger
example.a.ts
)npx tsc --noEmit a.ts
Expected Behavior
no type error
The text was updated successfully, but these errors were encountered: