-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix inferring the correct fn type #218
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@fastify/typescript Can you have a look please? I am actually highly confident, that this is the solution. |
Hey. This approach is new to me: instead of using polymorphism, we are going with a generic inference. I like it! I am wondering if there are other points in the Fastify ecosystem where we can use the same approach (the same one we did with the infamous triplet and the export = thing when we discovered it) |
How? Could you open a fresh issue? |
yes |
created an issue #221 |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify-plugin](https://togithub.com/fastify/fastify-plugin) | [`4.5.0` -> `4.5.1`](https://renovatebot.com/diffs/npm/fastify-plugin/4.5.0/4.5.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/fastify-plugin/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify-plugin/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify-plugin/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify-plugin/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify-plugin (fastify-plugin)</summary> ### [`v4.5.1`](https://togithub.com/fastify/fastify-plugin/releases/tag/v4.5.1) [Compare Source](https://togithub.com/fastify/fastify-plugin/compare/v4.5.0...v4.5.1) #### What's Changed - docs: rename next callback to done to make consistent with core by [@​58bits](https://togithub.com/58bits) in [https://github.com/fastify/fastify-plugin/pull/210](https://togithub.com/fastify/fastify-plugin/pull/210) - chore(.gitignore): add bun lockfile by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify-plugin/pull/211](https://togithub.com/fastify/fastify-plugin/pull/211) - build(deps-dev): bump tsd from 0.25.0 to 0.27.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify-plugin/pull/212](https://togithub.com/fastify/fastify-plugin/pull/212) - build(deps-dev): bump tsd from 0.27.0 to 0.28.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify-plugin/pull/213](https://togithub.com/fastify/fastify-plugin/pull/213) - build(deps-dev): bump [@​fastify/type-provider-typebox](https://togithub.com/fastify/type-provider-typebox) from 2.4.0 to 3.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify-plugin/pull/214](https://togithub.com/fastify/fastify-plugin/pull/214) - ci: only trigger on pushes to main branches by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify-plugin/pull/215](https://togithub.com/fastify/fastify-plugin/pull/215) - build(deps-dev): bump [@​types/node](https://togithub.com/types/node) from 18.16.5 to 20.1.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify-plugin/pull/216](https://togithub.com/fastify/fastify-plugin/pull/216) - fix inferring the correct fn type by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify-plugin/pull/218](https://togithub.com/fastify/fastify-plugin/pull/218) #### New Contributors - [@​58bits](https://togithub.com/58bits) made their first contribution in [https://github.com/fastify/fastify-plugin/pull/210](https://togithub.com/fastify/fastify-plugin/pull/210) **Full Changelog**: fastify/fastify-plugin@v4.5.0...v4.5.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 4pm on friday,before 9am on monday,every weekend" in timezone Europe/Paris, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/specfy/specfy). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6ImNob3JlL3Jlbm92YXRlQmFzZUJyYW5jaCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #217
I got help from @webstrand. Props to him.
It should now work.
According to webstrand
Maybe needs a new paragraph regarding typing in the readme.md were we basically write, that they should not use the generics but specify the types on the parameters, when calling fastifyPlugin?
Checklist
npm run test
andnpm run benchmark
and the Code of conduct