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

Support decorators #247

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nemanja-tosic
Copy link

WIP #5093

Checklist

interface Options {
foo: string
interface Options extends FastifyPluginOptions {
foo?: string

Choose a reason for hiding this comment

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

Not sure this change is needed 🤔

Suggested change
foo?: string
foo: string

Fn extends FastifyPluginCallback<Options, RawServer, TypeProvider, Logger> | FastifyPluginAsync<Options, RawServer, TypeProvider, Logger> = FastifyPluginCallback<Options, RawServer, TypeProvider, Logger>
>(
fn: Fn extends unknown ? Fn extends (...args: any) => Promise<any> ? FastifyPluginAsync<Options, RawServer, TypeProvider, Logger> : FastifyPluginCallback<Options, RawServer, TypeProvider, Logger> : Fn,
Plugin extends FastifyPluginCallback<Options, AnyFastifyInstance, AnyFastifyInstance> = FastifyPluginCallback<Options, AnyFastifyInstance, AnyFastifyInstance>>(

Choose a reason for hiding this comment

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

This is a breaking change: we're updating the number and type of generics. Can we avoid that? If not, I suspect we can only include it in the next major fastify version.

Copy link
Author

Choose a reason for hiding this comment

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

It is possible to keep the old version of fp. It was an open question whether or not we create a new util or update the old. A new util is possible, and "createPlugin" was added. I will make the change to keep fp as-is.

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