feat: Type narrow on status().send() chains with Reply generics#4823
feat: Type narrow on status().send() chains with Reply generics#4823mcollina merged 19 commits intofastify:mainfrom aadito123:main
Conversation
metcoder95
left a comment
There was a problem hiding this comment.
LGTM, nice work 🚀
Have nothing to add, but maybe ask if we could add this new feature to the docs, under the generics section maybe?
Having the generics well explained + an example can be of much help
Fair enough. Made a short addition to the docs with an example. I did not think it was necessary to mention the non-type-narrowed use case but I don't mind adding it if it seems like a reasonable inclusion. |
|
I saw this PR just now. Can I have a day to think about it, please? |
Co-authored-by: Uzlopak <aras.abbasi@googlemail.com>
voxpelli
left a comment
There was a problem hiding this comment.
Some feedback on how this could be simplified and/or reworded
Thanks a lot for going through my PR, @voxpelli You made a lot of suggestions so I thought I would address them in a reply.
type StringAsNumber<T extends string> = T extends `${infer N extends number}` ? N : never;
type Digit = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
type HttpCodes = StringAsNumber<`${Digit}${Digit | 0}${Digit | 0}`>;
type HttpKeys = HttpCodes | `${Digit}xx`;
export type StatusCodeReply = {
// eslint-disable-next-line no-unused-vars
[Key in HttpKeys]?: unknown;
};
// weird TS quirk: https://stackoverflow.com/questions/58977876/generic-conditional-type-resolves-to-never-when-the-generic-type-is-set-to-never
export type HttpCodesCovered<Key> = [Key] extends [never] ? number :
Key extends HttpCodes ? Key :
Key extends `${infer X extends Digit}xx` ?
StringAsNumber<`${X}${Digit | 0}${Digit | 0}`> : number;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line no-unused-vars
export type CodeToReplyKey<Code extends HttpKeys> = `${Code}` extends `${infer FirstDigit extends Digit}${infer RemainingDigits}`
? `${FirstDigit}xx`
: never;I think this is sufficiently terse without compromising functionality.
You're right, export type ReplyTypeConstrainer<RouteGenericReply, Code extends HttpCodesCovered<keyof RouteGenericReply>> =
RouteGenericReply extends StatusCodeReply ?
RouteGenericReply[Code extends keyof RouteGenericReply ? Code : Code extends keyof StatusCodeReply ? CodeToReplyKey<Code> : never] :
unknown;code<Code extends HttpCodesCovered<keyof RouteGeneric['Reply']>>(statusCode: Code): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, ReplyTypeConstrainer<RouteGeneric['Reply'], Code>>;
status<Code extends HttpCodesCovered<keyof RouteGeneric['Reply']>>(statusCode: Code): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, TypeProvider, ReplyTypeConstrainer<RouteGeneric['Reply'], Code>>;What do you think? I can push a commit for these changes if we're aligned. |
export type ReplyTypeConstrainer<Reply, Code extends HttpCodesCovered<keyof Reply>> =
Code extends keyof Reply ? Reply[Code] :
CodeToReplyKey<Code> extends keyof Reply ? Reply[CodeToReplyKey<Code>] :
unknown; |
|
@voxpelli Agree with basically all your feedback and made the changes. I limited the HttpCodes up to 500s to limit the size of unions. Typescript's union limit is 100K so I don't think performance should be too concerning at a couple hundred. However, I don't agree with the renaming. |
|
I forgot to pass the Reply type in the tests. Fixed! |
|
Any advice on why this test might be failing? My changes only affected the types. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.io/) ([source](https://togithub.com/fastify/fastify)) | [`4.18.0` -> `4.19.0`](https://renovatebot.com/diffs/npm/fastify/4.18.0/4.19.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.19.0`](https://togithub.com/fastify/fastify/releases/tag/v4.19.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.18.0...v4.19.0) #### What's Changed - fix: added a check to prevent creation of secondary server when external server is supplied by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - feat: added originalUrl in request object [#​4704](https://togithub.com/fastify/fastify/issues/4704) by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4758](https://togithub.com/fastify/fastify/pull/4758) - build(deps-dev): Bump markdownlint-cli2 from 0.7.1 to 0.8.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4819](https://togithub.com/fastify/fastify/pull/4819) - Add Platformatic to deploy strategies by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4822](https://togithub.com/fastify/fastify/pull/4822) - Fixed an error that occurred when sending an empty body as a buffer by [@​strelov1](https://togithub.com/strelov1) in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - docs(ecosystem): add fastify-better-sqlite3 by [@​punkish](https://togithub.com/punkish) in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - fix: correct type definition for genReqId argument by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4784](https://togithub.com/fastify/fastify/pull/4784) - fix typo by [@​is2ei](https://togithub.com/is2ei) in [https://github.com/fastify/fastify/pull/4828](https://togithub.com/fastify/fastify/pull/4828) - fix: handle undefined req.routeConfig in frameworkErrors by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4826](https://togithub.com/fastify/fastify/pull/4826) - build(deps-dev): Bump [@​sinonjs/fake-timers](https://togithub.com/sinonjs/fake-timers) from 10.2.0 to 11.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4818](https://togithub.com/fastify/fastify/pull/4818) - docs(Routes.md): added short description for constraints option by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4838](https://togithub.com/fastify/fastify/pull/4838) - \[fix] Tests are failing in Windows due to command line env syntax by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4845](https://togithub.com/fastify/fastify/pull/4845) - fix([#​4774](https://togithub.com/fastify/fastify/issues/4774)): close bindings through the hook system by [@​metcoder95](https://togithub.com/metcoder95) in [https://github.com/fastify/fastify/pull/4776](https://togithub.com/fastify/fastify/pull/4776) - Fix/add missing types fastifycontextconfig by [@​dancastillo](https://togithub.com/dancastillo) in [https://github.com/fastify/fastify/pull/4850](https://togithub.com/fastify/fastify/pull/4850) - Added "Principles" to explain the key technical principles behind Fastify by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4852](https://togithub.com/fastify/fastify/pull/4852) - pluginName will be exposed in FastifyInstance by [@​md-adil](https://togithub.com/md-adil) in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - fix: pass Fastify request to frameworkErrors and omit logging if disabled by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4825](https://togithub.com/fastify/fastify/pull/4825) - docs: Add documentation for zod type provider by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4456](https://togithub.com/fastify/fastify/pull/4456) - docs(ecosystem): add fastify cacheman by [@​aalfiann](https://togithub.com/aalfiann) in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - build(deps-dev): Bump eslint-plugin-n from 15.7.0 to 16.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4857](https://togithub.com/fastify/fastify/pull/4857) - fix: return 431 status code on HTTP header overflow error by [@​nflaig](https://togithub.com/nflaig) in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - ci: trigger the new website build by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4839](https://togithub.com/fastify/fastify/pull/4839) - Do not leak memory if .listen()\` is not called by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4860](https://togithub.com/fastify/fastify/pull/4860) - Extend `decorate()` etc to enforce defined values by [@​voxpelli](https://togithub.com/voxpelli) in [https://github.com/fastify/fastify/pull/4858](https://togithub.com/fastify/fastify/pull/4858) - minor jsdoc fixes by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4855](https://togithub.com/fastify/fastify/pull/4855) - feat: Type narrow on status().send() chains with Reply generics by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) #### New Contributors - [@​aarontravass](https://togithub.com/aarontravass) made their first contribution in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - [@​strelov1](https://togithub.com/strelov1) made their first contribution in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - [@​punkish](https://togithub.com/punkish) made their first contribution in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - [@​md-adil](https://togithub.com/md-adil) made their first contribution in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - [@​aalfiann](https://togithub.com/aalfiann) made their first contribution in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - [@​nflaig](https://togithub.com/nflaig) made their first contribution in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - [@​aadito123](https://togithub.com/aadito123) made their first contribution in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) **Full Changelog**: fastify/fastify@v4.18.0...v4.19.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), 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/tomacheese/telcheck). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.io/) ([source](https://togithub.com/fastify/fastify)) | [`4.18.0` -> `4.19.0`](https://renovatebot.com/diffs/npm/fastify/4.18.0/4.19.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.19.0`](https://togithub.com/fastify/fastify/releases/tag/v4.19.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.18.0...v4.19.0) ##### What's Changed - fix: added a check to prevent creation of secondary server when external server is supplied by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - feat: added originalUrl in request object [#​4704](https://togithub.com/fastify/fastify/issues/4704) by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4758](https://togithub.com/fastify/fastify/pull/4758) - build(deps-dev): Bump markdownlint-cli2 from 0.7.1 to 0.8.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4819](https://togithub.com/fastify/fastify/pull/4819) - Add Platformatic to deploy strategies by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4822](https://togithub.com/fastify/fastify/pull/4822) - Fixed an error that occurred when sending an empty body as a buffer by [@​strelov1](https://togithub.com/strelov1) in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - docs(ecosystem): add fastify-better-sqlite3 by [@​punkish](https://togithub.com/punkish) in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - fix: correct type definition for genReqId argument by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4784](https://togithub.com/fastify/fastify/pull/4784) - fix typo by [@​is2ei](https://togithub.com/is2ei) in [https://github.com/fastify/fastify/pull/4828](https://togithub.com/fastify/fastify/pull/4828) - fix: handle undefined req.routeConfig in frameworkErrors by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4826](https://togithub.com/fastify/fastify/pull/4826) - build(deps-dev): Bump [@​sinonjs/fake-timers](https://togithub.com/sinonjs/fake-timers) from 10.2.0 to 11.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4818](https://togithub.com/fastify/fastify/pull/4818) - docs(Routes.md): added short description for constraints option by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4838](https://togithub.com/fastify/fastify/pull/4838) - \[fix] Tests are failing in Windows due to command line env syntax by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4845](https://togithub.com/fastify/fastify/pull/4845) - fix([#​4774](https://togithub.com/fastify/fastify/issues/4774)): close bindings through the hook system by [@​metcoder95](https://togithub.com/metcoder95) in [https://github.com/fastify/fastify/pull/4776](https://togithub.com/fastify/fastify/pull/4776) - Fix/add missing types fastifycontextconfig by [@​dancastillo](https://togithub.com/dancastillo) in [https://github.com/fastify/fastify/pull/4850](https://togithub.com/fastify/fastify/pull/4850) - Added "Principles" to explain the key technical principles behind Fastify by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4852](https://togithub.com/fastify/fastify/pull/4852) - pluginName will be exposed in FastifyInstance by [@​md-adil](https://togithub.com/md-adil) in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - fix: pass Fastify request to frameworkErrors and omit logging if disabled by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4825](https://togithub.com/fastify/fastify/pull/4825) - docs: Add documentation for zod type provider by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4456](https://togithub.com/fastify/fastify/pull/4456) - docs(ecosystem): add fastify cacheman by [@​aalfiann](https://togithub.com/aalfiann) in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - build(deps-dev): Bump eslint-plugin-n from 15.7.0 to 16.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4857](https://togithub.com/fastify/fastify/pull/4857) - fix: return 431 status code on HTTP header overflow error by [@​nflaig](https://togithub.com/nflaig) in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - ci: trigger the new website build by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4839](https://togithub.com/fastify/fastify/pull/4839) - Do not leak memory if .listen()\` is not called by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4860](https://togithub.com/fastify/fastify/pull/4860) - Extend `decorate()` etc to enforce defined values by [@​voxpelli](https://togithub.com/voxpelli) in [https://github.com/fastify/fastify/pull/4858](https://togithub.com/fastify/fastify/pull/4858) - minor jsdoc fixes by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4855](https://togithub.com/fastify/fastify/pull/4855) - feat: Type narrow on status().send() chains with Reply generics by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) ##### New Contributors - [@​aarontravass](https://togithub.com/aarontravass) made their first contribution in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - [@​strelov1](https://togithub.com/strelov1) made their first contribution in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - [@​punkish](https://togithub.com/punkish) made their first contribution in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - [@​md-adil](https://togithub.com/md-adil) made their first contribution in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - [@​aalfiann](https://togithub.com/aalfiann) made their first contribution in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - [@​nflaig](https://togithub.com/nflaig) made their first contribution in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - [@​aadito123](https://togithub.com/aadito123) made their first contribution in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) **Full Changelog**: fastify/fastify@v4.18.0...v4.19.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), 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/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
|
@aadito123 I think we broke something here. In my ErrorHandler instance I'm getting an error My ErrorHandler type looks like this: export const errorHandler = function (
this: FastifyInstance,
error: Record<string, unknown>,
request: FastifyRequest,
reply: FastifyReply,
) {
// responseObject resolution code that doesn't matter
//
// next line doesn't compile anymore
void reply.status(responseObject.statusCode).send(responseObject.payload)
}We should adjust default type to be more permissive, to avoid the change being a breaking change. Can you also please add documentation on how this case should be handled? There is no Server type in this case. |
|
@kibertoad this change was supposed to return unknown for the default types but it seems I missed a case. Will push a PR to fix it immediately, with a test case. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.io/) ([source](https://togithub.com/fastify/fastify)) | [`4.18.0` -> `4.19.0`](https://renovatebot.com/diffs/npm/fastify/4.18.0/4.19.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.19.0`](https://togithub.com/fastify/fastify/releases/tag/v4.19.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.18.0...v4.19.0) ##### What's Changed - fix: added a check to prevent creation of secondary server when external server is supplied by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - feat: added originalUrl in request object [#​4704](https://togithub.com/fastify/fastify/issues/4704) by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4758](https://togithub.com/fastify/fastify/pull/4758) - build(deps-dev): Bump markdownlint-cli2 from 0.7.1 to 0.8.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4819](https://togithub.com/fastify/fastify/pull/4819) - Add Platformatic to deploy strategies by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4822](https://togithub.com/fastify/fastify/pull/4822) - Fixed an error that occurred when sending an empty body as a buffer by [@​strelov1](https://togithub.com/strelov1) in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - docs(ecosystem): add fastify-better-sqlite3 by [@​punkish](https://togithub.com/punkish) in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - fix: correct type definition for genReqId argument by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4784](https://togithub.com/fastify/fastify/pull/4784) - fix typo by [@​is2ei](https://togithub.com/is2ei) in [https://github.com/fastify/fastify/pull/4828](https://togithub.com/fastify/fastify/pull/4828) - fix: handle undefined req.routeConfig in frameworkErrors by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4826](https://togithub.com/fastify/fastify/pull/4826) - build(deps-dev): Bump [@​sinonjs/fake-timers](https://togithub.com/sinonjs/fake-timers) from 10.2.0 to 11.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4818](https://togithub.com/fastify/fastify/pull/4818) - docs(Routes.md): added short description for constraints option by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4838](https://togithub.com/fastify/fastify/pull/4838) - \[fix] Tests are failing in Windows due to command line env syntax by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4845](https://togithub.com/fastify/fastify/pull/4845) - fix([#​4774](https://togithub.com/fastify/fastify/issues/4774)): close bindings through the hook system by [@​metcoder95](https://togithub.com/metcoder95) in [https://github.com/fastify/fastify/pull/4776](https://togithub.com/fastify/fastify/pull/4776) - Fix/add missing types fastifycontextconfig by [@​dancastillo](https://togithub.com/dancastillo) in [https://github.com/fastify/fastify/pull/4850](https://togithub.com/fastify/fastify/pull/4850) - Added "Principles" to explain the key technical principles behind Fastify by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4852](https://togithub.com/fastify/fastify/pull/4852) - pluginName will be exposed in FastifyInstance by [@​md-adil](https://togithub.com/md-adil) in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - fix: pass Fastify request to frameworkErrors and omit logging if disabled by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4825](https://togithub.com/fastify/fastify/pull/4825) - docs: Add documentation for zod type provider by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4456](https://togithub.com/fastify/fastify/pull/4456) - docs(ecosystem): add fastify cacheman by [@​aalfiann](https://togithub.com/aalfiann) in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - build(deps-dev): Bump eslint-plugin-n from 15.7.0 to 16.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4857](https://togithub.com/fastify/fastify/pull/4857) - fix: return 431 status code on HTTP header overflow error by [@​nflaig](https://togithub.com/nflaig) in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - ci: trigger the new website build by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4839](https://togithub.com/fastify/fastify/pull/4839) - Do not leak memory if .listen()\` is not called by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4860](https://togithub.com/fastify/fastify/pull/4860) - Extend `decorate()` etc to enforce defined values by [@​voxpelli](https://togithub.com/voxpelli) in [https://github.com/fastify/fastify/pull/4858](https://togithub.com/fastify/fastify/pull/4858) - minor jsdoc fixes by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4855](https://togithub.com/fastify/fastify/pull/4855) - feat: Type narrow on status().send() chains with Reply generics by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) ##### New Contributors - [@​aarontravass](https://togithub.com/aarontravass) made their first contribution in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - [@​strelov1](https://togithub.com/strelov1) made their first contribution in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - [@​punkish](https://togithub.com/punkish) made their first contribution in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - [@​md-adil](https://togithub.com/md-adil) made their first contribution in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - [@​aalfiann](https://togithub.com/aalfiann) made their first contribution in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - [@​nflaig](https://togithub.com/nflaig) made their first contribution in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - [@​aadito123](https://togithub.com/aadito123) made their first contribution in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) **Full Changelog**: fastify/fastify@v4.18.0...v4.19.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), 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/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.io/) ([source](https://togithub.com/fastify/fastify)) | [`4.15.0` -> `4.19.2`](https://renovatebot.com/diffs/npm/fastify/4.15.0/4.19.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.19.2`](https://togithub.com/fastify/fastify/releases/tag/v4.19.2) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.19.1...v4.19.2) #### What's Changed - fix(typescript): route config should not pass url and method by [@​climba03003](https://togithub.com/climba03003) in [https://github.com/fastify/fastify/pull/4872](https://togithub.com/fastify/fastify/pull/4872) - Overload `DecorationMethod` to fix [#​4870](https://togithub.com/fastify/fastify/issues/4870) by [@​voxpelli](https://togithub.com/voxpelli) in [https://github.com/fastify/fastify/pull/4874](https://togithub.com/fastify/fastify/pull/4874) - fix: Type inference breaking when Reply generic is not passed by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4875](https://togithub.com/fastify/fastify/pull/4875) - fix: regression with close and serverFactory by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4876](https://togithub.com/fastify/fastify/pull/4876) **Full Changelog**: fastify/fastify@v4.19.1...v4.19.2 ### [`v4.19.1`](https://togithub.com/fastify/fastify/releases/tag/v4.19.1) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.19.0...v4.19.1) #### What's Changed - docs(typescript): fix typo by [@​jon-codes](https://togithub.com/jon-codes) in [https://github.com/fastify/fastify/pull/4861](https://togithub.com/fastify/fastify/pull/4861) - docs(testing): add plugin testing guide by [@​Ekott2006](https://togithub.com/Ekott2006) in [https://github.com/fastify/fastify/pull/4849](https://togithub.com/fastify/fastify/pull/4849) - docs: fix platformatic-cloud anchor id by [@​sher](https://togithub.com/sher) in [https://github.com/fastify/fastify/pull/4863](https://togithub.com/fastify/fastify/pull/4863) - fix: Type narrow fix issue from PR [#​4823](https://togithub.com/fastify/fastify/issues/4823) by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4869](https://togithub.com/fastify/fastify/pull/4869) #### New Contributors - [@​jon-codes](https://togithub.com/jon-codes) made their first contribution in [https://github.com/fastify/fastify/pull/4861](https://togithub.com/fastify/fastify/pull/4861) - [@​sher](https://togithub.com/sher) made their first contribution in [https://github.com/fastify/fastify/pull/4863](https://togithub.com/fastify/fastify/pull/4863) **Full Changelog**: fastify/fastify@v4.19.0...v4.19.1 ### [`v4.19.0`](https://togithub.com/fastify/fastify/releases/tag/v4.19.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.18.0...v4.19.0) #### What's Changed - fix: added a check to prevent creation of secondary server when external server is supplied by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - feat: added originalUrl in request object [#​4704](https://togithub.com/fastify/fastify/issues/4704) by [@​aarontravass](https://togithub.com/aarontravass) in [https://github.com/fastify/fastify/pull/4758](https://togithub.com/fastify/fastify/pull/4758) - build(deps-dev): Bump markdownlint-cli2 from 0.7.1 to 0.8.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4819](https://togithub.com/fastify/fastify/pull/4819) - Add Platformatic to deploy strategies by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4822](https://togithub.com/fastify/fastify/pull/4822) - Fixed an error that occurred when sending an empty body as a buffer by [@​strelov1](https://togithub.com/strelov1) in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - docs(ecosystem): add fastify-better-sqlite3 by [@​punkish](https://togithub.com/punkish) in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - fix: correct type definition for genReqId argument by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4784](https://togithub.com/fastify/fastify/pull/4784) - fix typo by [@​is2ei](https://togithub.com/is2ei) in [https://github.com/fastify/fastify/pull/4828](https://togithub.com/fastify/fastify/pull/4828) - fix: handle undefined req.routeConfig in frameworkErrors by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4826](https://togithub.com/fastify/fastify/pull/4826) - build(deps-dev): Bump [@​sinonjs/fake-timers](https://togithub.com/sinonjs/fake-timers) from 10.2.0 to 11.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4818](https://togithub.com/fastify/fastify/pull/4818) - docs(Routes.md): added short description for constraints option by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4838](https://togithub.com/fastify/fastify/pull/4838) - \[fix] Tests are failing in Windows due to command line env syntax by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4845](https://togithub.com/fastify/fastify/pull/4845) - fix([#​4774](https://togithub.com/fastify/fastify/issues/4774)): close bindings through the hook system by [@​metcoder95](https://togithub.com/metcoder95) in [https://github.com/fastify/fastify/pull/4776](https://togithub.com/fastify/fastify/pull/4776) - Fix/add missing types fastifycontextconfig by [@​dancastillo](https://togithub.com/dancastillo) in [https://github.com/fastify/fastify/pull/4850](https://togithub.com/fastify/fastify/pull/4850) - Added "Principles" to explain the key technical principles behind Fastify by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4852](https://togithub.com/fastify/fastify/pull/4852) - pluginName will be exposed in FastifyInstance by [@​md-adil](https://togithub.com/md-adil) in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - fix: pass Fastify request to frameworkErrors and omit logging if disabled by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4825](https://togithub.com/fastify/fastify/pull/4825) - docs: Add documentation for zod type provider by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4456](https://togithub.com/fastify/fastify/pull/4456) - docs(ecosystem): add fastify cacheman by [@​aalfiann](https://togithub.com/aalfiann) in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - build(deps-dev): Bump eslint-plugin-n from 15.7.0 to 16.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4857](https://togithub.com/fastify/fastify/pull/4857) - fix: return 431 status code on HTTP header overflow error by [@​nflaig](https://togithub.com/nflaig) in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - ci: trigger the new website build by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4839](https://togithub.com/fastify/fastify/pull/4839) - Do not leak memory if .listen()\` is not called by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4860](https://togithub.com/fastify/fastify/pull/4860) - Extend `decorate()` etc to enforce defined values by [@​voxpelli](https://togithub.com/voxpelli) in [https://github.com/fastify/fastify/pull/4858](https://togithub.com/fastify/fastify/pull/4858) - minor jsdoc fixes by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4855](https://togithub.com/fastify/fastify/pull/4855) - feat: Type narrow on status().send() chains with Reply generics by [@​aadito123](https://togithub.com/aadito123) in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) #### New Contributors - [@​aarontravass](https://togithub.com/aarontravass) made their first contribution in [https://github.com/fastify/fastify/pull/4741](https://togithub.com/fastify/fastify/pull/4741) - [@​strelov1](https://togithub.com/strelov1) made their first contribution in [https://github.com/fastify/fastify/pull/4797](https://togithub.com/fastify/fastify/pull/4797) - [@​punkish](https://togithub.com/punkish) made their first contribution in [https://github.com/fastify/fastify/pull/4812](https://togithub.com/fastify/fastify/pull/4812) - [@​md-adil](https://togithub.com/md-adil) made their first contribution in [https://github.com/fastify/fastify/pull/4848](https://togithub.com/fastify/fastify/pull/4848) - [@​aalfiann](https://togithub.com/aalfiann) made their first contribution in [https://github.com/fastify/fastify/pull/4851](https://togithub.com/fastify/fastify/pull/4851) - [@​nflaig](https://togithub.com/nflaig) made their first contribution in [https://github.com/fastify/fastify/pull/4856](https://togithub.com/fastify/fastify/pull/4856) - [@​aadito123](https://togithub.com/aadito123) made their first contribution in [https://github.com/fastify/fastify/pull/4823](https://togithub.com/fastify/fastify/pull/4823) **Full Changelog**: fastify/fastify@v4.18.0...v4.19.0 ### [`v4.18.0`](https://togithub.com/fastify/fastify/releases/tag/v4.18.0) [Compare Source](https://togithub.com/fastify/fastify/compare/4.17.0...v4.18.0) #### What's Changed - Update GOVERNANCE.md by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4709](https://togithub.com/fastify/fastify/pull/4709) - docs: add fastify-opaque-apake to Ecosystem.md by [@​cyyynthia](https://togithub.com/cyyynthia) in [https://github.com/fastify/fastify/pull/4712](https://togithub.com/fastify/fastify/pull/4712) - ci: only trigger on pushes to main branches by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify/pull/4714](https://togithub.com/fastify/fastify/pull/4714) - ci: test using pnpm 8 by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify/pull/4720](https://togithub.com/fastify/fastify/pull/4720) - ci(integration): only trigger on pushes to main branches by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify/pull/4721](https://togithub.com/fastify/fastify/pull/4721) - Maintain custom response schema by [@​jaschaephraim](https://togithub.com/jaschaephraim) in [https://github.com/fastify/fastify/pull/4718](https://togithub.com/fastify/fastify/pull/4718) - build(deps): Bump lycheeverse/lychee-action from 1.6.1 to 1.7.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4723](https://togithub.com/fastify/fastify/pull/4723) - docs(readme): move table of contents by [@​ileighAube](https://togithub.com/ileighAube) in [https://github.com/fastify/fastify/pull/4722](https://togithub.com/fastify/fastify/pull/4722) - Updates to docs and types regarding the `res` serializer by [@​bienzaaron](https://togithub.com/bienzaaron) in [https://github.com/fastify/fastify/pull/4716](https://togithub.com/fastify/fastify/pull/4716) - chore(deps): bump process-warning to ^2.2.0 by [@​climba03003](https://togithub.com/climba03003) in [https://github.com/fastify/fastify/pull/4726](https://togithub.com/fastify/fastify/pull/4726) - build(deps): bump dependencies by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify/pull/4727](https://togithub.com/fastify/fastify/pull/4727) - Add mention to default error handler on reply send by [@​paul-jolimoi](https://togithub.com/paul-jolimoi) in [https://github.com/fastify/fastify/pull/4713](https://togithub.com/fastify/fastify/pull/4713) - chore: fix Reply.md internal link by [@​climba03003](https://togithub.com/climba03003) in [https://github.com/fastify/fastify/pull/4731](https://togithub.com/fastify/fastify/pull/4731) - Chore(Workflow): Update website.yml by [@​luisorbaiceta](https://togithub.com/luisorbaiceta) in [https://github.com/fastify/fastify/pull/4736](https://togithub.com/fastify/fastify/pull/4736) - feat: add listeningOrigin fastify immutable instance property ([#​4586](https://togithub.com/fastify/fastify/issues/4586)) by [@​zsimo](https://togithub.com/zsimo) in [https://github.com/fastify/fastify/pull/4674](https://togithub.com/fastify/fastify/pull/4674) - 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/pull/4738](https://togithub.com/fastify/fastify/pull/4738) - chore: add test-compare action by [@​RafaelGSS](https://togithub.com/RafaelGSS) in [https://github.com/fastify/fastify/pull/4737](https://togithub.com/fastify/fastify/pull/4737) - support send typedarray objects ([#​4715](https://togithub.com/fastify/fastify/issues/4715)) by [@​Ceereals](https://togithub.com/Ceereals) in [https://github.com/fastify/fastify/pull/4735](https://togithub.com/fastify/fastify/pull/4735) - doc: remove RafaelGSS from plugins team by [@​RafaelGSS](https://togithub.com/RafaelGSS) in [https://github.com/fastify/fastify/pull/4746](https://togithub.com/fastify/fastify/pull/4746) - Typo correction from extendible to extensible by [@​devhabib429](https://togithub.com/devhabib429) in [https://github.com/fastify/fastify/pull/4745](https://togithub.com/fastify/fastify/pull/4745) - Allow lowercase methods when registering routes by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4750](https://togithub.com/fastify/fastify/pull/4750) - Fix lowercase HTTP methods type by [@​matthyk](https://togithub.com/matthyk) in [https://github.com/fastify/fastify/pull/4757](https://togithub.com/fastify/fastify/pull/4757) - Add missing trailer method definitions by [@​atesgoral](https://togithub.com/atesgoral) in [https://github.com/fastify/fastify/pull/4759](https://togithub.com/fastify/fastify/pull/4759) - fix: benchmark:parser script by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4765](https://togithub.com/fastify/fastify/pull/4765) - Remove debug logging for URL rewrite by [@​brettwillis](https://togithub.com/brettwillis) in [https://github.com/fastify/fastify/pull/4754](https://togithub.com/fastify/fastify/pull/4754) - chore: pin json-schema-to-ts by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4770](https://togithub.com/fastify/fastify/pull/4770) - feat: async validation support by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4752](https://togithub.com/fastify/fastify/pull/4752) - docs(ecosystem): add fastify-evervault plugin by [@​Briscoooe](https://togithub.com/Briscoooe) in [https://github.com/fastify/fastify/pull/4771](https://togithub.com/fastify/fastify/pull/4771) - revert: hotfix dev dep by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4775](https://togithub.com/fastify/fastify/pull/4775) - docs(request): fix typo in compileValidationSchema function name by [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) in [https://github.com/fastify/fastify/pull/4780](https://togithub.com/fastify/fastify/pull/4780) - Rename types/tsconfig.json to types/tsconfig.eslint.json to avoid hoisting by vscode by [@​nopeless](https://togithub.com/nopeless) in [https://github.com/fastify/fastify/pull/4773](https://togithub.com/fastify/fastify/pull/4773) - build(deps): Bump lycheeverse/lychee-action from 1.7.0 to 1.8.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4779](https://togithub.com/fastify/fastify/pull/4779) - fix: update removeHeader type to be FastifyReply by [@​dancastillo](https://togithub.com/dancastillo) in [https://github.com/fastify/fastify/pull/4781](https://togithub.com/fastify/fastify/pull/4781) - Making Vercel Serverless docs easier to use by [@​Ekott2006](https://togithub.com/Ekott2006) in [https://github.com/fastify/fastify/pull/4793](https://togithub.com/fastify/fastify/pull/4793) - ci: ignore node-14 on windows by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4800](https://togithub.com/fastify/fastify/pull/4800) - body reader to use statusCode from stream error, if available ([#​4785](https://togithub.com/fastify/fastify/issues/4785)) by [@​sergburn](https://togithub.com/sergburn) in [https://github.com/fastify/fastify/pull/4787](https://togithub.com/fastify/fastify/pull/4787) - workflow(benchmark): update node version by [@​RafaelGSS](https://togithub.com/RafaelGSS) in [https://github.com/fastify/fastify/pull/4786](https://togithub.com/fastify/fastify/pull/4786) - add sync-next workflow by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4801](https://togithub.com/fastify/fastify/pull/4801) - remove double validation of onReady-hook by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4799](https://togithub.com/fastify/fastify/pull/4799) - ci(ci): replace node 19 with node 20 in test matrices by [@​Fdawgs](https://togithub.com/Fdawgs) in [https://github.com/fastify/fastify/pull/4691](https://togithub.com/fastify/fastify/pull/4691) - Fix broken CI by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4809](https://togithub.com/fastify/fastify/pull/4809) - reset listening state for each secondary server by [@​cjihrig](https://togithub.com/cjihrig) in [https://github.com/fastify/fastify/pull/4810](https://togithub.com/fastify/fastify/pull/4810) #### New Contributors - [@​jaschaephraim](https://togithub.com/jaschaephraim) made their first contribution in [https://github.com/fastify/fastify/pull/4718](https://togithub.com/fastify/fastify/pull/4718) - [@​ileighAube](https://togithub.com/ileighAube) made their first contribution in [https://github.com/fastify/fastify/pull/4722](https://togithub.com/fastify/fastify/pull/4722) - [@​bienzaaron](https://togithub.com/bienzaaron) made their first contribution in [https://github.com/fastify/fastify/pull/4716](https://togithub.com/fastify/fastify/pull/4716) - [@​paul-jolimoi](https://togithub.com/paul-jolimoi) made their first contribution in [https://github.com/fastify/fastify/pull/4713](https://togithub.com/fastify/fastify/pull/4713) - [@​zsimo](https://togithub.com/zsimo) made their first contribution in [https://github.com/fastify/fastify/pull/4674](https://togithub.com/fastify/fastify/pull/4674) - [@​Ceereals](https://togithub.com/Ceereals) made their first contribution in [https://github.com/fastify/fastify/pull/4735](https://togithub.com/fastify/fastify/pull/4735) - [@​devhabib429](https://togithub.com/devhabib429) made their first contribution in [https://github.com/fastify/fastify/pull/4745](https://togithub.com/fastify/fastify/pull/4745) - [@​atesgoral](https://togithub.com/atesgoral) made their first contribution in [https://github.com/fastify/fastify/pull/4759](https://togithub.com/fastify/fastify/pull/4759) - [@​brettwillis](https://togithub.com/brettwillis) made their first contribution in [https://github.com/fastify/fastify/pull/4754](https://togithub.com/fastify/fastify/pull/4754) - [@​Briscoooe](https://togithub.com/Briscoooe) made their first contribution in [https://github.com/fastify/fastify/pull/4771](https://togithub.com/fastify/fastify/pull/4771) - [@​giuliowaitforitdavide](https://togithub.com/giuliowaitforitdavide) made their first contribution in [https://github.com/fastify/fastify/pull/4780](https://togithub.com/fastify/fastify/pull/4780) - [@​nopeless](https://togithub.com/nopeless) made their first contribution in [https://github.com/fastify/fastify/pull/4773](https://togithub.com/fastify/fastify/pull/4773) - [@​Ekott2006](https://togithub.com/Ekott2006) made their first contribution in [https://github.com/fastify/fastify/pull/4793](https://togithub.com/fastify/fastify/pull/4793) - [@​sergburn](https://togithub.com/sergburn) made their first contribution in [https://github.com/fastify/fastify/pull/4787](https://togithub.com/fastify/fastify/pull/4787) - [@​cjihrig](https://togithub.com/cjihrig) made their first contribution in [https://github.com/fastify/fastify/pull/4810](https://togithub.com/fastify/fastify/pull/4810) **Full Changelog**: fastify/fastify@v4.17.0...v4.18.0 ### [`v4.17.0`](https://togithub.com/fastify/fastify/releases/tag/v4.17.0) [Compare Source](https://togithub.com/fastify/fastify/compare/4.16.3...4.17.0) #### What's Changed - Add codes to framework errors that lack one by [@​lilsweetcaligula](https://togithub.com/lilsweetcaligula) in [https://github.com/fastify/fastify/pull/4632](https://togithub.com/fastify/fastify/pull/4632) - fix: revert changes made to route hook types by [@​vidarc](https://togithub.com/vidarc) in [https://github.com/fastify/fastify/pull/4708](https://togithub.com/fastify/fastify/pull/4708) #### New Contributors - [@​lilsweetcaligula](https://togithub.com/lilsweetcaligula) made their first contribution in [https://github.com/fastify/fastify/pull/4632](https://togithub.com/fastify/fastify/pull/4632) - [@​vidarc](https://togithub.com/vidarc) made their first contribution in [https://github.com/fastify/fastify/pull/4708](https://togithub.com/fastify/fastify/pull/4708) **Full Changelog**: fastify/fastify@4.16.3...4.17.0 ### [`v4.16.3`](https://togithub.com/fastify/fastify/releases/tag/v4.16.3) [Compare Source](https://togithub.com/fastify/fastify/compare/4.16.2...4.16.3) **Full Changelog**: fastify/fastify@4.16.2...4.16.3 ### [`v4.16.2`](https://togithub.com/fastify/fastify/releases/tag/v4.16.2) [Compare Source](https://togithub.com/fastify/fastify/compare/4.16.1...4.16.2) **Full Changelog**: fastify/fastify@4.16.1...4.16.2 ### [`v4.16.1`](https://togithub.com/fastify/fastify/releases/tag/v4.16.1) [Compare Source](https://togithub.com/fastify/fastify/compare/4.16.0...4.16.1) **Full Changelog**: fastify/fastify@4.16.0...4.16.1 ### [`v4.16.0`](https://togithub.com/fastify/fastify/releases/tag/v4.16.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.15.0...4.16.0) #### What's Changed - docs: spelling, punctuation & grammar minor nits by [@​shusak](https://togithub.com/shusak) in [https://github.com/fastify/fastify/pull/4642](https://togithub.com/fastify/fastify/pull/4642) - docs(mongodb): update to mongodb 5 by [@​pip77](https://togithub.com/pip77) in [https://github.com/fastify/fastify/pull/4646](https://togithub.com/fastify/fastify/pull/4646) - Install pnpm version 7 to support Node.js 14 in CI by [@​Yvad60](https://togithub.com/Yvad60) in [https://github.com/fastify/fastify/pull/4645](https://togithub.com/fastify/fastify/pull/4645) - build(deps-dev): Bump typescript from 4.9.5 to 5.0.3 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4658](https://togithub.com/fastify/fastify/pull/4658) - build(deps-dev): Bump [@​sinclair/typebox](https://togithub.com/sinclair/typebox) from 0.25.24 to 0.26.8 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4660](https://togithub.com/fastify/fastify/pull/4660) - Add `fastify-koa` plugin by [@​rozzilla](https://togithub.com/rozzilla) in [https://github.com/fastify/fastify/pull/4654](https://togithub.com/fastify/fastify/pull/4654) - Prevent labeler from removing existing labels by [@​luisorbaiceta](https://togithub.com/luisorbaiceta) in [https://github.com/fastify/fastify/pull/4662](https://togithub.com/fastify/fastify/pull/4662) - Emit a warning when validating undefined schemas by [@​franher](https://togithub.com/franher) in [https://github.com/fastify/fastify/pull/4647](https://togithub.com/fastify/fastify/pull/4647) - chore(ecosystem): rename to fastify-orama plugin by [@​mateonunez](https://togithub.com/mateonunez) in [https://github.com/fastify/fastify/pull/4667](https://togithub.com/fastify/fastify/pull/4667) - Add workflow for benchmarking POST with custom parsers by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4669](https://togithub.com/fastify/fastify/pull/4669) - chore: add `github actions` label automatically by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4664](https://togithub.com/fastify/fastify/pull/4664) - Adds async hooks signature on route level by [@​JbIPS](https://togithub.com/JbIPS) in [https://github.com/fastify/fastify/pull/4655](https://togithub.com/fastify/fastify/pull/4655) - chore(docs): update from cobraz to simenandre by [@​simenandre](https://togithub.com/simenandre) in [https://github.com/fastify/fastify/pull/4671](https://togithub.com/fastify/fastify/pull/4671) - Documentation: link from Hooks onRoute to routeOptions definition by [@​cvuorinen](https://togithub.com/cvuorinen) in [https://github.com/fastify/fastify/pull/4678](https://togithub.com/fastify/fastify/pull/4678) - docs: incorrect example for 'onRequestAbort' hook by [@​TimShilov](https://togithub.com/TimShilov) in [https://github.com/fastify/fastify/pull/4679](https://togithub.com/fastify/fastify/pull/4679) - doc: add fastify-type-provider-effect-schema by [@​NexZhu](https://togithub.com/NexZhu) in [https://github.com/fastify/fastify/pull/4683](https://togithub.com/fastify/fastify/pull/4683) - doc: update prototype poisoning by [@​AliakbarETH](https://togithub.com/AliakbarETH) in [https://github.com/fastify/fastify/pull/4651](https://togithub.com/fastify/fastify/pull/4651) - docs: add optional URL param to upgrade guide and route docs ([#​4637](https://togithub.com/fastify/fastify/issues/4637)) by [@​mateus4k](https://togithub.com/mateus4k) in [https://github.com/fastify/fastify/pull/4680](https://togithub.com/fastify/fastify/pull/4680) - build(deps-dev): Bump markdownlint-cli2 from 0.6.0 to 0.7.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4695](https://togithub.com/fastify/fastify/pull/4695) - Add fastify-redis-session plugin by [@​mohammadraufzahed](https://togithub.com/mohammadraufzahed) in [https://github.com/fastify/fastify/pull/4656](https://togithub.com/fastify/fastify/pull/4656) - test: refactor logger test by [@​climba03003](https://togithub.com/climba03003) in [https://github.com/fastify/fastify/pull/4648](https://togithub.com/fastify/fastify/pull/4648) - chore: fix badge link by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4699](https://togithub.com/fastify/fastify/pull/4699) - docs: add fastify-log-controller to ecosystem by [@​Eomm](https://togithub.com/Eomm) in [https://github.com/fastify/fastify/pull/4696](https://togithub.com/fastify/fastify/pull/4696) - build(deps-dev): Bump tsd from 0.26.1 to 0.28.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4659](https://togithub.com/fastify/fastify/pull/4659) - build(deps-dev): Bump [@​sinclair/typebox](https://togithub.com/sinclair/typebox) from 0.26.8 to 0.28.6 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4700](https://togithub.com/fastify/fastify/pull/4700) - use Object.prototype.hasOwnProperty in compileSchemasForValidation by [@​Uzlopak](https://togithub.com/Uzlopak) in [https://github.com/fastify/fastify/pull/4692](https://togithub.com/fastify/fastify/pull/4692) - Implement support for passing custom text resolution for starting log… by [@​kibertoad](https://togithub.com/kibertoad) in [https://github.com/fastify/fastify/pull/4698](https://togithub.com/fastify/fastify/pull/4698) - refactor: export FastifyBaseLogger as interface instead of type alias by [@​tzafrirben](https://togithub.com/tzafrirben) in [https://github.com/fastify/fastify/pull/4681](https://togithub.com/fastify/fastify/pull/4681) - build(deps): Bump tiny-lru from 10.4.1 to 11.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/fastify/fastify/pull/4694](https://togithub.com/fastify/fastify/pull/4694) - Added preClose hook by [@​mcollina](https://togithub.com/mcollina) in [https://github.com/fastify/fastify/pull/4697](https://togithub.com/fastify/fastify/pull/4697) #### New Contributors - [@​shusak](https://togithub.com/shusak) made their first contribution in [https://github.com/fastify/fastify/pull/4642](https://togithub.com/fastify/fastify/pull/4642) - [@​pip77](https://togithub.com/pip77) made their first contribution in [https://github.com/fastify/fastify/pull/4646](https://togithub.com/fastify/fastify/pull/4646) - [@​Yvad60](https://togithub.com/Yvad60) made their first contribution in [https://github.com/fastify/fastify/pull/4645](https://togithub.com/fastify/fastify/pull/4645) - [@​rozzilla](https://togithub.com/rozzilla) made their first contribution in [https://github.com/fastify/fastify/pull/4654](https://togithub.com/fastify/fastify/pull/4654) - [@​franher](https://togithub.com/franher) made their first contribution in [https://github.com/fastify/fastify/pull/4647](https://togithub.com/fastify/fastify/pull/4647) - [@​JbIPS](https://togithub.com/JbIPS) made their first contribution in [https://github.com/fastify/fastify/pull/4655](https://togithub.com/fastify/fastify/pull/4655) - [@​cvuorinen](https://togithub.com/cvuorinen) made their first contribution in [https://github.com/fastify/fastify/pull/4678](https://togithub.com/fastify/fastify/pull/4678) - [@​TimShilov](https://togithub.com/TimShilov) made their first contribution in [https://github.com/fastify/fastify/pull/4679](https://togithub.com/fastify/fastify/pull/4679) - [@​NexZhu](https://togithub.com/NexZhu) made their first contribution in [https://github.com/fastify/fastify/pull/4683](https://togithub.com/fastify/fastify/pull/4683) - [@​AliakbarETH](https://togithub.com/AliakbarETH) made their first contribution in [https://github.com/fastify/fastify/pull/4651](https://togithub.com/fastify/fastify/pull/4651) - [@​mateus4k](https://togithub.com/mateus4k) made their first contribution in [https://github.com/fastify/fastify/pull/4680](https://togithub.com/fastify/fastify/pull/4680) - [@​mohammadraufzahed](https://togithub.com/mohammadraufzahed) made their first contribution in [https://github.com/fastify/fastify/pull/4656](https://togithub.com/fastify/fastify/pull/4656) - [@​tzafrirben](https://togithub.com/tzafrirben) made their first contribution in [https://github.com/fastify/fastify/pull/4681](https://togithub.com/fastify/fastify/pull/4681) **Full Changelog**: fastify/fastify@v4.15.0...4.16.0 </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:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi41LjMiLCJ0YXJnZXRCcmFuY2giOiJjaG9yZS9yZW5vdmF0ZUJhc2VCcmFuY2gifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Added type narrowing on chained .status(xxx).send(xxx) calls only using reply generics.
Previously tried doing this using the schema but it seems the typescript team preferred doing it through generics instead
as noted here.
Checklist
npm run testandnpm run benchmarkand the Code of conduct