Sometimes, we want to add type aliases with TypeScript.
In this article, we’ll look at how to add type aliases with TypeScript.
How to add type aliases with TypeScript?
To add type aliases with TypeScript, we can use the type
keyword.
For instance, we write
type PrimitiveArray = Array<string | number | boolean>;
to create the PrimitiveArray
type with the type
keyword which is an array with string, number, or boolean entries.
Conclusion
To add type aliases with TypeScript, we can use the type
keyword.