String literal type in TypeScript
With the help of the type union operator, you can combine not only built-in types, but also strings. For example, let's make it so that a variable can only take one of two string values:
typescriptlet str: 'success' | 'error';
Let's check. Let's write a variable one of the lines:
typescriptstr = 'success';
Let's write the second one:
typescriptstr = 'error';
But trying to write a different line will result in an error:
typescriptstr = 'eee'; //
Задание 1
Make the variable take one of three values: 'error', 'warning', or 'success'.