Issue
For example a string that can only be two characters long, which could be used for an ISO country code.
I have used Google and looked through the documentation but cannot find the answer.
Solution
There isn't a way to specify a string length as a type.
If you have a finite list of country codes, you could write a string literal type:
type CountryCode = 'US' | 'CN' | 'CA' | ...(lots of others);
Answered By - Ryan Cavanaugh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.