AlexJPotter / fluentvalidation-ts

A TypeScript-first library for building strongly-typed validation rules
Apache License 2.0
87 stars 6 forks source link

Export the RuleValidators type as part of the API #47

Closed ValdisThomann closed 8 months ago

ValdisThomann commented 1 year ago

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?

AlexJPotter commented 8 months ago

Hi @ValdisThomann - thanks for your patience on this 🙂 I've just released v3.2.0 that adds the desired type exports - please let me know if you have any further issues!

ValdisThomann commented 8 months ago

Awesome, thanks!

On Wed, 6 Mar 2024, 3:52 am Alex Potter, @.***> wrote:

Hi @ValdisThomann https://github.com/ValdisThomann - thanks for your patience on this 🙂 I've just released v3.2.0 https://github.com/AlexJPotter/fluentvalidation-ts/releases/tag/v3.2.0 that adds the desired type exports - please let me know if you have any further issues!

— Reply to this email directly, view it on GitHub https://github.com/AlexJPotter/fluentvalidation-ts/pull/47#issuecomment-1979213043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKGV26CCNUCGMSMVNDUUFLYWXZ43AVCNFSM6AAAAAA7SHB4AWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZZGIYTGMBUGM . You are receiving this because you were mentioned.Message ID: @.***>