feat(fastify): add type for http options #13869
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fastify has support for http options through the fastify function call which was not officially included in the nest adapter. Currently passing an object with a http field works, but gives the developer no type hinting about the
http
field.First time open source contributor so please let me know what is not correct.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently creating an http server we cannot pass any http options without fooling the typescript type system. So this works, but in my opinion more magical than explicit.
I use a property from the type
FastifyServerOptions
so it makes Typescript happy but also pass another property called http which will be used by fastify to create a server.What is the new behavior?
With addition of the new type you can now do this (likewise the https property):
Does this PR introduce a breaking change?