Open juliandm opened 2 years ago
Although i like the concept of ts-auto-guard i solved it now by combining two other more standardised open source projects:
works beautifully and also template literals and other advanced features of ts are worked on.
@juliandm you can use debug mode to information about the first field that failed, however it is not intended for production.
This library is not a validation library, it generates type guards, which conventionally do not give more information other than is or is not a type.
That said when I first started working on this I did intend to create an option to generate validators, which is why it needs type-guard
in the comment annotation (so that I could later add type-validator
etc.) But if you're looking for runtime type validator you're better off using a library that explicitly has that as one of its goals.
I'll leave this issue open for now in case there's any more discussion.
currently the generated functions just return a Boolean value. However in cases where ts-auto-guard is used for user feedback, a simple yes or no is not sufficient. A path to the faulty attributes would be better
success response
faulty example, could be even more specific about, which type was expected etc..