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

make typing for attach and log functions correct #2238

Merged
merged 4 commits into from
Feb 12, 2023

Conversation

davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Feb 12, 2023

πŸ€” What's changed?

Make the typings for this.attach more accurate by providing overload definitions. Also correct the this.log type as it can never yield a promise.

Included tsd test that would fail without these changes.

⚑️ What's your motivation?

Fixes #2143 re the ambiguity of whether or not to expect a promise for stream attachments (depends on whether you pass in a callback), but it also improves the type safety around mediaType which is really only optional for string attachments.

🏷️ What kind of change is this?

  • πŸ› Bug fix (non-breaking change which fixes a defect)

πŸ“‹ Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@coveralls
Copy link

coveralls commented Feb 12, 2023

Coverage Status

Coverage: 98.563%. Remained the same when pulling 437687b on fix/attachment-function-types into 93ee7ee on main.

@davidjgoss davidjgoss marked this pull request as ready for review February 12, 2023 11:52
@davidjgoss davidjgoss merged commit 35d6743 into main Feb 12, 2023
@davidjgoss davidjgoss deleted the fix/attachment-function-types branch February 12, 2023 12:33
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.

AttachmentManager Overload Definitions
2 participants