⊗jstsPmBsSLA 21 of 55 menu

Aliases for Concatenating Strings in TypeScript

To concatenate strings, you can enter your own type using a given alias. Let's do that:

type message = 'success' | 'error';

Let's declare a variable with our new type:

let str: message;

Let's write some value into this variable:

str = 'success';

Make a data type that will allow a variable to take on one of three values: 'error', 'warning', or 'success'.

byenru