-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
[jquery] Fix return types for JQuery.map
, JQueryStatic.map
, and JQueryStatic()
.
#26524
Conversation
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.
@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 If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@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! |
…ons. (cherry picked from commit 2506245)
Thanks! |
superseeds my #26027 |
Constraints on
JQuery
,JQueryStatic
,EventHandler
, andEventHandlerBase
asJQuery.map
were dropped. This was necessary to implement the fixes and more accurately models theJQuery
object.Fixes #19597
JQuery.map
The type parameter of the
JQuery
object returned fromJQuery.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 returnedJQuery
object.Fixes #19597
Closes #26503
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
https://api.jquery.com/map/
https://api.jquery.com/jQuery.map/
https://api.jquery.com/jQuery/
Increase the version number in the header if appropriate.If you are making substantial changes, consider adding atslint.json
containing{ "extends": "dtslint/dt.json" }
.