payload icon indicating copy to clipboard operation
payload copied to clipboard

chore: ensure condition result is always boolean

Open AlessioGr opened this issue 2 years ago • 0 comments

Description

Closes #4577

This is not really a fix, since this was no bug in the first place.

But, to make this functionality more robust against user error (if a user returns an object in the condition function which is incorrect, but typescript doesn't warn them as that object is typed as any. This happened in https://github.com/payloadcms/payload/issues/4410)

  • [X] I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • [X] Chore (non-breaking change which does not add functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Change to the templates directory (does not affect core functionality)
  • [ ] Change to the examples directory (does not affect core functionality)
  • [ ] This change requires a documentation update

Checklist:

  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] Existing test suite passes locally with my changes
  • [ ] I have made corresponding changes to the documentation

AlessioGr avatar Dec 20 '23 20:12 AlessioGr