I have the array:
const studyTypes = [
{
value: "ENG",
label: "ENG-RU",
},
{
value: "RU",
label: "RU-ENG",
},
];
And the state:
const [typeStudy, setTypeStudy] = React.useState<string>("ENG");
How can I specify in typescript that my typeStudy
can only take one of the value
from the studyTypes
array instead of a <string>
? In this case the typeStudy
can be either "ENG" or "RU".