-
Notifications
You must be signed in to change notification settings - Fork 18
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
Should ToArray() and Each() not provide JQuery objects? #15
Comments
you say: "iterate over elements of a jQuery object". |
I'm not exactly sure what distinction you're making, @rusco. Probably I spoke unclearly. In straight jQuery, |
I am just questioning the assumptions you make: "... returns an array of jQuery objects". I think it's an array of plain (untyped) objects. The typescript definition files say it's "any[]" in case of toArray and an "element" as an argument for each: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L2784 https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L2830 |
OIC. Yes, you're right: https://jsfiddle.net/hgnxmqk8/ In that case, I suggest rather returning |
There may be other such instances, but at least the two functions
ToArray()
andEach()
iterate over elements of a jQuery object, exposing each element as another jQuery object in turn. However, the current implementation exposes them asinterface{}
s, which must then be coerced back intojquery.JQuery
objects. Wouldn't it be more natural to just expose these directly? Would this ever be incorrect? Specifically, change the functions to have these signatures:The text was updated successfully, but these errors were encountered: