-
Notifications
You must be signed in to change notification settings - Fork 10
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
collection.first vs collection.first() ? #81
Comments
There is a problem with Option 2, the typescript usage has to be:
We have to explicitly identify that the return type is Collection, not Element :( Is there any way to make the usage nice? o_O |
have fixed last problem with:
but here goes a question... "Will now autocomplere |
…sponding sliced collection and changed collection.first() to .first as property - this breaks API a bit 2. renamed condition.collection.hasSizeMoreThan to .hasSizeGreaterThan accordig to english grammar, also added .hasSizeGreaterThanOrEqual .hasSizeLessThanOrEqual and all corresponding have.* aliases; 3. removed commented SearchContext implementations and corresponding locator; 4. removed predicate parameter from element.followingSibling and make it property (again, breaks API a bit); 5. added changelog
do you think that thinking about how some ide's will provide autocomplete is a reason to don't use such cool feature? I would leave it as you provided in last comment, since it's super cool, and we already have some features which won't support autocomplete (f.e. |
as I remember, autocomplete worked for |
hm, it really works :D |
So far (unfortunately we already released it in "stable" 1.0.0), we have implemented collection.first not as getter property but as method... (compare with element.parent whigh is implemented as property)
So... property or method? (we still can quick-fix 1.0.0 in 1.0.1 :D)
Here are things to take into account:
Option 1
pros:
cons:
VS Option 2
pros:
cons:
fi
tofirst
without (), and since all other "no arguments" methods are without parentheses in this context - the user will probably forget to add parentheses and will get a weird error, but good, at least, that he get it at compile time...if
statement inside), and less KISS - harder for the user to understand its usage (yet it's not driving a space shuttle of course...)I tend to implement option 2. Since we already have
first
as method (not property) in 1.0.0 and it is of more user-oriented style, and general API will be more consistent with it... I will tune the current implementation tofirst(count?: number)
, but let's finally define where we go...The text was updated successfully, but these errors were encountered: