ts-interface-checker icon indicating copy to clipboard operation
ts-interface-checker copied to clipboard

[Feature] plugins to enhance type validation

Open mdesousa opened this issue 3 years ago • 5 comments

Thanks for this awesome library! It is very well thought out.

It would be great if it could provide support to inject additional logic to validate certain types. For example, given the type below:

type Iso8601Date = string;

I would like to add logic that verifies that the value is a valid date formatted as "YYYY-MM-DD". I can see many other scenarios where similar validations would be useful. For example, for certain numbers you may want to verify that they are within a specific range (e.g. a "Percent" type would need to be between 0 and 100). Certain string types may need to be checked for length. An Email or PhoneType could be checked with a RegEx... etc.

mdesousa avatar Jan 12 '21 13:01 mdesousa