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

[jquery] Fix return types for JQuery.map, JQueryStatic.map, and JQueryStatic(). #26524

Merged
merged 9 commits into from
Jun 17, 2018

Conversation

leonard-thieu
Copy link
Contributor

@leonard-thieu leonard-thieu commented Jun 13, 2018

Constraints on JQuery, JQueryStatic, EventHandler, and EventHandlerBase as JQuery.map were dropped. This was necessary to implement the fixes and more accurately models the JQuery object.

Fixes #19597

JQuery.map

The type parameter of the JQuery object returned from JQuery.map depends on the return values of the callback. Previously, the type parameter was based on the object it was called on. This fix also implements the array collapsing and item filtering behaviors.

Fixes #20890

JQueryStatic.map

Implemented the array collapsing and item filtering behaviors.

JQueryStatic()

JQueryStatic() now uses the argument passed in to determine the type parameter of the returned JQuery object.

Fixes #19597


Closes #26503


Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

The type parameter of the JQuery object returned from `JQuery.map` depends on the return values of the callback. Previously, the type parameter was based on the object it was called on.

This fix requires dropping constraints on `JQuery`, `JQueryStatic`, `EventHandler`, and `EventHandlerBase` as `JQuery.map` may return `JQuery` objects that contain non-`Node` values.
@typescript-bot
Copy link
Contributor

typescript-bot commented Jun 13, 2018

@leonard-thieu Thank you for submitting this PR!

🔔 @denisname @jonathanhedren @borisyankov @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @johnnyreilly @DickvdBrink @King2500 @huww98 @MaximBalaganskiy @MonizDave @broccoliarchy - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). The Travis CI build failed labels Jun 13, 2018
@typescript-bot
Copy link
Contributor

typescript-bot commented Jun 13, 2018

@leonard-thieu The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@johnnyreilly
Copy link
Member

Thanks!

@HolgerJeromin
Copy link
Contributor

superseeds my #26027

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Popular package This PR affects a popular package (as counted by NPM download counts).
Projects
None yet
4 participants