-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Hello,
I would suggest to add a "regex literal" type to make ensuring that a string data matches a pattern at assigment.
As the literal string feature has been added in the latest release, i found very convenient to type my variables with, e.g. for typing my react props (size : "small"| "big" )... On the same idea, it could be convenient to be able to type a variable with a pattern.
Example :
var myString : /\d{3}.*\d{2}/;
myString="555hhhhh44" ; //correct
myString="55dsds5dss4"; //error
In react it could be vey useful for defining a react prop like phone numbers, emails, dates, ...
regards
Xavier
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created