Check out a free preview of the full TypeScript Fundamentals course:
The "Type Aliases" Lesson is part of the full, TypeScript Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Mike shows how to use the type keyword to define a type alias.

Get Unlimited Access Now

Transcript from the "Type Aliases" Lesson

[00:00:00]
>> Mike North: So finally, before we begin the next exercise there's this one last clue that's gonna help you out. We can create a type alias, particularly when you're working with tuples. It's tough to look at a tuple and kind of keep all of these straight, right. You might have three or four or five things that all look like three numbers together.

[00:00:20] Like this could be a color rgb or it could be xyz coordinates or something like that. We can give it a name using a type, the type keyword. So here we're saying, I'm gonna use this word color and what I really mean is a tuple of size three containing number, number, number.

[00:00:41]
>> Mike North: You can export this and import it from another class, or use it in another interface, whatever you wanna do. This color now, it is usable anywhere, other types are usable. Just like in interface, just like these type literals we've been creating. So, feel free to go about using that.