Skip to content

Conversation

@ggoodman
Copy link
Contributor

@ggoodman ggoodman commented Dec 20, 2019

Previously, the type of the function returned by flags.mustCall did not match the type of the function being passed in. As a result, attempts to use the function returned by flags.mustCall would lack type safety.

* @returns a wrapped function.
*/
mustCall(func: Function, count: number): Function;
mustCall<T extends (...args: any[]) => any>(func: T, count: number): T;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might impose some version constraints on the typescript version that can consume the typing info.

Copy link
Contributor

Choose a reason for hiding this comment

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

We only support latest TS versions. Is this a breaking change or not because it wasn't working to begin with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, sorry I didn't get back earlier. I agree with your assessment; this should be treated as a bugfix IMHO because it produces a more correct typing result.

@hueniverse hueniverse merged commit 0d6f0eb into hapijs:master Dec 28, 2019
@hueniverse hueniverse self-assigned this Dec 28, 2019
@hueniverse hueniverse added bug Bug or defect types TypeScript type definitions labels Dec 28, 2019
@hueniverse hueniverse added this to the 21.0.1 milestone Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug or defect types TypeScript type definitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants