Skip to content

fix: Type inference breaking when Reply generic is not passed#4875

Merged
mcollina merged 25 commits intofastify:mainfrom
aadito123:main
Jul 3, 2023
Merged

fix: Type inference breaking when Reply generic is not passed#4875
mcollina merged 25 commits intofastify:mainfrom
aadito123:main

Conversation

@aadito123
Copy link
Contributor

Checklist

There was an error caused by #4823 that broke inference in a special case where the schema is provided, Reply generic is not provided and .code().send() is chained.

This would cause the type of .send to default to (payload?: unknown) => FastifyReply, even though a response type could be inferred from the schema. Fixed!

@github-actions github-actions bot added the typescript TypeScript related label Jul 3, 2023
@mcollina mcollina requested a review from climba03003 July 3, 2023 13:02
@mcollina
Copy link
Member

mcollina commented Jul 3, 2023

cc @voxpelli

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit e3a2812 into fastify:main Jul 3, 2023
renovate bot referenced this pull request in tomacheese/telcheck Jul 3, 2023
[![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](https://www.fastify.io/)
([source](https://togithub.com/fastify/fastify)) | [`4.19.1` ->
`4.19.2`](https://renovatebot.com/diffs/npm/fastify/4.19.1/4.19.2) |
[![age](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/compatibility-slim/4.19.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/confidence-slim/4.19.1)](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
[@&#8203;climba03003](https://togithub.com/climba03003) in
[https://github.com/fastify/fastify/pull/4872](https://togithub.com/fastify/fastify/pull/4872)
- Overload `DecorationMethod` to fix
[#&#8203;4870](https://togithub.com/fastify/fastify/issues/4870) by
[@&#8203;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
[@&#8203;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
[@&#8203;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

</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>
jtoar referenced this pull request in redwoodjs/graphql Jul 4, 2023
[![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](https://www.fastify.io/)
([source](https://togithub.com/fastify/fastify)) | [`4.19.0` ->
`4.19.2`](https://renovatebot.com/diffs/npm/fastify/4.19.0/4.19.2) |
[![age](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/compatibility-slim/4.19.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/confidence-slim/4.19.0)](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
[@&#8203;climba03003](https://togithub.com/climba03003) in
[https://github.com/fastify/fastify/pull/4872](https://togithub.com/fastify/fastify/pull/4872)
- Overload `DecorationMethod` to fix
[#&#8203;4870](https://togithub.com/fastify/fastify/issues/4870) by
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[#&#8203;4823](https://togithub.com/fastify/fastify/issues/4823) by
[@&#8203;aadito123](https://togithub.com/aadito123) in
[https://github.com/fastify/fastify/pull/4869](https://togithub.com/fastify/fastify/pull/4869)

#### New Contributors

- [@&#8203;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)
- [@&#8203;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

</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>
jtoar referenced this pull request in redwoodjs/graphql Jul 5, 2023
[![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](https://www.fastify.io/)
([source](https://togithub.com/fastify/fastify)) | [`4.19.0` ->
`4.19.2`](https://renovatebot.com/diffs/npm/fastify/4.19.0/4.19.2) |
[![age](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/compatibility-slim/4.19.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/fastify/4.19.2/confidence-slim/4.19.0)](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
[@&#8203;climba03003](https://togithub.com/climba03003) in
[https://github.com/fastify/fastify/pull/4872](https://togithub.com/fastify/fastify/pull/4872)
- Overload `DecorationMethod` to fix
[#&#8203;4870](https://togithub.com/fastify/fastify/issues/4870) by
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[#&#8203;4823](https://togithub.com/fastify/fastify/issues/4823) by
[@&#8203;aadito123](https://togithub.com/aadito123) in
[https://github.com/fastify/fastify/pull/4869](https://togithub.com/fastify/fastify/pull/4869)

#### New Contributors

- [@&#8203;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)
- [@&#8203;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

</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>
@Fyrlex
Copy link

Fyrlex commented Jul 5, 2023

still getting this issue where .send({}) isn't typed despite correct generic args with v4.19.2. it works on v4.12.0

@climba03003
Copy link
Member

still getting this issue where .send({}) isn't typed despite correct generic args with v4.19.2. it works on v4.12.0

Please provide an reproducible code snippets and open a dedicated issue for your problem.

@fastify fastify locked as resolved and limited conversation to collaborators Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

typescript TypeScript related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants