Courses / TypeScript
6. Type aliases (type)
Defining custom type aliases for clearer domain types in incremental typing.
JavaScript (TypeScript-style type aliases)
Type aliases (type)
A type alias gives a short, meaningful name to a specific shape or union of values so code reads like your domain language.
"I want my function signatures to say 'UserId' instead of just 'string' so the code documents intent."
A type alias assigns a name to a type expression (object shape, union, primitive, etc.) so you can reuse and document that shape; it doesn't create a new runtime value. It's a compile-time, developer-facing shorthand.
"I want my function signatures to say 'UserId' instead of just 'string' so the code documents intent."
A type alias assigns a name to a type expression (object shape, union, primitive, etc.) so you can reuse and document that shape; it doesn't create a new runtime value. It's a compile-time, developer-facing shorthand.