Now when working with union types like this and this can be cumbersome to always repeat the union type
you might want to create a new type which he store is this union type and you can do that with a number
of cool types would feature the feature of type aliases you create such alias typically before you use
it.
So here at the top of the file in this case here with the type keyword now to type keyword is not built
into javascript.
It's supported in typescript though and after type you add the name of your custom type or of your type
alias I should say for example combined label but the name is really up to you.
You can invent any name here which is not built into JavaScript or typescript as a key name something
like date would not be allowed because that's built into javascript but combined ABL is not built into
javascript not built into typescript so we can use it.
And now with an equal sign you assign the type you want to encode in your alias.
So to say so we could store a number here and now whenever we want to make sure that something should
be a number we could use combined ABL instead.
Now that doesn't make too much sense.
It arguably would even make our code harder to read.
If I use combined a down there for example this would work technically but if we just glance over our
code it's not obvious that here we want a number or a string.
Well typically therefore you use that in conjunction with union types so we can store a union type in
our custom type so to say in our type alias.
And now just refer to combine them all down there instead of our union type.
So we have exactly the same setup I asked before.
We just have our reusable type alias here which we can use instead and that allows us to save some extra
code and make sure we always refer to the same types or the same type setup when we use combined all.
And of course we can not just use that for number and string.
We can use that for any type setup we might want to stored in an alias including these two literal types
for example.
So for these two types here for this union type we could also create a type alias conversion descriptor
or however you want to name it and store exactly this type in this type alias.
And now we can use this type alias down there.
So type aliases are really really useful.
You can encode more complex type definitions into your own types into your own type names.
So to say and reuse that everywhere in your code where you need exactly this type setup.
So did you have wide typos down there and you can simply save code write code quicker and also be clearer
about your intentions for example by choosing descriptive type alias names up there.