List of Strings:
const myStrings = ["one", "two", "three"];
const newString = "two";
The variable newString
is currently just a string, but I would like its type to be an element of myStrings
.
Is there a way to achieve this even if the values in the array are subject to change?