Skip to content

Fix the weird function signature of async callbacks #490

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

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

ExplodingCabbage
Copy link
Collaborator

@ExplodingCabbage ExplodingCabbage commented Feb 15, 2024

Previously, the callback option had to be a function that takes the result as its second argument; the first argument, meanwhile, was never used. (Some tests name the parameter err; however, there is absolutely no circumstance in which an error, or anything besides undefined, will be passed as the value of that argument.)

This PR fixes this (utterly breaking backwards compat in the process) by making the result be passed as the value of the FIRST argument.

Resolves #462

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@ExplodingCabbage ExplodingCabbage marked this pull request as ready for review February 15, 2024 18:19
@ExplodingCabbage ExplodingCabbage merged commit 13d9749 into master Feb 15, 2024
@ExplodingCabbage ExplodingCabbage deleted the fix-weird-callback-signature branch February 15, 2024 18:20
ExplodingCabbage added a commit that referenced this pull request Feb 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
ExplodingCabbage added a commit that referenced this pull request Feb 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…xecution in async mode (#489)

* Add test demonstrating race condition with this.options

* Update signature to reflect #490

* Eliminate this.options

* Add release notes

* Update docs
ryota-ka added a commit to ryota-ka/DefinitelyTyped that referenced this pull request Oct 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…option, the diff result will now be passed as the first argument to the callback instead of the second

kpdecker/jsdiff#490
ryota-ka added a commit to ryota-ka/DefinitelyTyped that referenced this pull request Oct 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…option, the diff result will now be passed as the first argument to the callback instead of the second

kpdecker/jsdiff#490
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.

callback option has a weird signature
1 participant