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

Use a union-aware keyof operator #4076

Merged
merged 2 commits into from Jun 24, 2022
Merged

Use a union-aware keyof operator #4076

merged 2 commits into from Jun 24, 2022

Conversation

A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Jun 23, 2022

Fixes #4063

Based off of https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types.

I believe this still satisfies the initial reason these keyofs were here. As a previous comment on ResolveFastifyRequestContext (the previous generation of this) said:

/**
 * This type handles request context resolution either via generic arguments
 * or type provider. If the user specifies both generic arguments as well as
 * a type provider, this type will override the type provider and use the
 * generic arguments. This enables users to override undesirable inference
 * behaviours in the type provider.
 */

Checklist

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
Copy link
Member

Good work!

@mcollina mcollina merged commit 4d1fb5f into fastify:main Jun 24, 2022
@A5rocks
Copy link
Contributor Author

A5rocks commented Jun 24, 2022

Thanks!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 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.

TypeScript reports errors when union type passed as Body to RouteGeneric since Fastify 4
3 participants