collect.js
collect.js copied to clipboard
default functions should be optional
The main thing I wanted out of this PR was making the default functions optional. I then started correcting the logic based on Laravel's logic and adding types.
I've used unkown
here as we don't know what is going to be returned. I've also copied laravel unless
method. It and when
take the value as the second argument in the closures, so we effectively don't know what will be returned.
After looking through the code and working on a few PRs I think this package needs to be rewritten in TS. I'm happy to help out as I use this package quite a bit. Writing in typescript will remove disconnect between the javascript and the type definitions.
Let's discuss what's possible @ecrmnn
Hi, @patrickomeara
Thanks for your feedback and contribution 😄 I'll have a closer look once I get the time.
I appreciate your work on types and would encourage you to make more contributions on this 🙌
It would be great to transition towards TS, but personally I don't have the time and therefore no intention to rewrite the package to TS.