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: 🐛 typings around server.decorate #4538

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

damusix
Copy link
Contributor

@damusix damusix commented Jan 19, 2025

  • Types match the validation a bit more.
  • Type errors when attempting to decorate a builtin.
  • No any when decorating a non-method
  • Can never extend a handler method
  • Can never extend or apply a non-method

Continued from #4525

- The code currently allows any value to be added as a decorator, but the
types do not. This work allows any value to be added to a decorator by
updating the types to reflect what the code does
- Add relevant tests
- Update inline docs
- Create and export DecorationValue type
- Fixes hapijs#4524
These extra definitions specify how to use value instead of method
@damusix damusix changed the base branch from update-decorator-types to next January 19, 2025 06:16
@damusix damusix changed the base branch from next to master January 19, 2025 06:16
Types match the validation a bit more. Type errors with error when
attempting to decorate a builtin.
@damusix damusix force-pushed the update-decorator-types branch from c829767 to 97e8fe0 Compare January 19, 2025 06:25
@damusix
Copy link
Contributor Author

damusix commented Jan 19, 2025

@kanongil @Marsup Need your eyes por favor. I'll fix quickly.

@feedmypixel Thanks for the initiation of this PR. I think I've finished it. If you have suggestions, feel free to comment.

Copy link
Contributor

@feedmypixel feedmypixel left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@damusix thanks so much for picking this up and apologies I didn't get to it.

@Marsup Marsup added this to the 21.4.0 milestone Mar 5, 2025
@Marsup Marsup merged commit 30d043e into hapijs:master Mar 5, 2025
10 checks passed
@Marsup Marsup added the types TypeScript type definitions label Mar 5, 2025
@Marsup Marsup self-assigned this Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types TypeScript type definitions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants