Export the RuleValidators type as part of the API #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there!
Thanks for writing such an awesome library - I really appreciate it.
I've used it to great effect in an angular project, extending the angular
FormGroup
so that you can actually have strongly-typed validation rules (instead of the OOB experience which only allows abstract rules).I was going to turn this into a little angular library, but I've hit a snag. My implementation creates a custom rule validator, which basically unpacks the value from the angular form field and passes it to
ruleForTransformed()
. This works fine using the inferred type for that method when the implementation is within my consuming application. However, the compiler blows up when I try to export the type declarations for that inferred type.There's a pretty easy fix for this - it all works fine if I import
RuleValidators
and explicitly type my custom rule validator.Would you be happy to approve this change to the API, to allow me (and others) to extend rule validators?