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

Fix type argument inference of session.get(key) and session.set(key, value) #249

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

zetaraku
Copy link
Contributor

@zetaraku zetaraku commented Apr 29, 2024

The current generic method session.get(key) accidentally allows the return value to be inferred into any type.

The session.set(key, value) also allows value of any type to be passed in.

Image

Note: This fix removes the second generic param V, so it will break an undocumented usage for TypeScript users specifying both two generic type parameters. (This should be rare.)

Checklist

Signed-off-by: Raku Zeta <zetaraku@gmail.com>
Signed-off-by: Raku Zeta <zetaraku@gmail.com>
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 90ee1f5 into fastify:master May 7, 2024
17 of 19 checks passed
@zetaraku zetaraku deleted the patch-1 branch May 23, 2024 15:49
@zetaraku zetaraku mentioned this pull request Jul 3, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants