You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know I can constrain a parameter to one of items in a list:
/** @typedef {'a'|'b'|'c'} Alphabet *//** @param {Alphabet} s */functionwrite(s){// s will be one of 'a', 'b', or 'c'}write('a')// workswrite('z')// fails
But what if it's a combination of items in list that is also a string?
I know I can constrain a parameter to one of items in a list:
But what if it's a combination of items in list that is also a string?
I can constrain the input type to
Array.<Alphabet>
but I do need it to be a string. Help appreciated.The text was updated successfully, but these errors were encountered: