Type alias
A type alias is a declaration that gives a type or type expression an alternative name without introducing a distinct nominal type.
Essential TypeScript 5, Third Edition
A type alias is a named TypeScript type definition that can represent an existing type or a composed type.
- How it is used
- Names reusable type definitions to reduce duplication in function signatures, object shapes, and application data schemas.
- How deep it goes
- Defines the syntax and works through several applications, while noting that an alias does not change compiler treatment.
- Examples
- Uses item counts, product arrays, city strings, a Lowdb task schema, and objects created by a constructor function.
- What you can do after
- Apply it via TypeScript annotations and assertions to reuse type definitions and check shaped application data.
Read how Essential TypeScript 5, Third Edition explains type alias →
Go in Action, Second Edition
A type alias gives an existing type an alternate name without creating a distinct type.
- How it is used
- Distinguishes alternate names for existing types from distinct defined types, and gives common integer values more meaningful names.
- How deep it goes
- Defines alias syntax and interchangeability, contrasting aliases with distinct defined types and their ability to have methods.
- Examples
- Uses `byte` as an alias for `uint8` and `rune` as an alias for `int32`.
- What you can do after
- Evaluate/understand when an alternate type name remains interchangeable rather than creating a distinct type.
Learn Haskell by Example
A type synonym gives an existing type an alternate name without creating a distinct representation or type identity.
- How it is used
- Clarifies the intended role of ordinary representations such as character lists, filenames, and strings.
- How deep it goes
- Defines aliases, demonstrates interchangeability, and stops short of creating a distinct type identity.
- Examples
- Uses Alphabet for cipher alphabets, FilePath for command-line filenames, and GHCi commands for inspection.
- What you can do after
- Apply type synonyms in Haskell code and inspect their resulting values and signatures through GHCi.
Kotlin in Action, 2E
A type alias is a Kotlin declaration that gives an alternative name to an existing type without creating a distinct type.
- How it is used
- Improves readability by naming long generic or functional types without changing how those types behave.
- How deep it goes
- Explains declaration syntax, usage, tradeoffs, and compile-time expansion, but stops short of adding type safety.
- Examples
- Uses the NameCombiner functional alias and contrasts a ValidatedInput alias with a value class.
- What you can do after
- Apply it by naming repeated complex types while recognizing when a distinct value class is required for stronger type separation.
Type-Driven Development with Idris
A type synonym is an alternative name for an existing type, often chosen to make the type's meaning clearer.
- How it is used
- Clarifies composite types with descriptive names and supports calculating types from inputs.
- How deep it goes
- Defines simple and parameterized synonyms, then demonstrates their evaluation and use with interactive editing tools.
- Examples
- Uses coordinate pairs and a triangle represented as a vector of positions.
- What you can do after
- Apply it by naming coordinate pairs Position and vectors of positions Polygon n.
Read how Type-Driven Development with Idris explains type alias →
Learn C++ by Example
A type alias is a declaration that gives an existing type an alternative name.
- How it is used
- Defines a readable name for a custom std::chrono duration used in practical time conversions.
- How deep it goes
- Defines the using form through a century-duration example and defers broader details about using to later coverage.
- Examples
- Uses a centuries alias to represent two hundred years and convert that duration into seconds, hours, and days.
- What you can do after
- Build it from scratch by naming a parameterized chrono duration with using and applying the alias in conversions.
Modern C
A type alias is an alternative name for an existing C type that does not create a distinct type.
- How it is used
- Introduces readable names for existing C types, especially structures and arrays.
- How deep it goes
- Explains alias identity, structure forward declarations, array syntax, and _t reservation rules.
- Examples
- Uses multidimensional double arrays, staged array aliases, structure declarations, and size_t as examples.
- What you can do after
- Apply it via typedef to name existing structures, arrays, and other C types without changing their identities.
Also covered in
- Modern C, Third Edition
- Learn Rust in a Month of Lunches
- Go in Practice, Second Edition
- Code Like a Pro in Rust
- 100 C++ Mistakes and How to Avoid Them
What to know first
- primitive typeA primitive type is a predefined basic data type representing a simple value rather than a composite structure of multiple values or fields.
- stringA string is a programming-language value representing textual data as an ordered sequence of characters or encoded units.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- structA struct is a named composite type or data structure that groups multiple fields or values into one structured unit.
Related concepts
- typedefproduced by · typedef is a C and C++ declaration mechanism that introduces an alternative name for an existing type.
- type-level functionkind of · A function whose input and output are evaluated or interpreted in type positions to determine types.
- newtype idiomcontrasts with · The newtype idiom creates a distinct type by wrapping an existing type, giving its values separate type-level identity while typically preserving their underlying representation.
- atomic typecontrasts with · An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
Questions about type alias
What is type alias?
A type alias is a declaration that gives a type or type expression an alternative name without introducing a distinct nominal type.
Which Manning books explain type alias?
Essential TypeScript 5, Third Edition, Go in Action, Second Edition, Learn Haskell by Example, Kotlin in Action, 2E, Type-Driven Development with Idris, Learn C++ by Example and Modern C.
What should I know before learning type alias?
Manning books that teach type alias usually introduce primitive type, string, array and struct first.
What is the difference between type alias and newtype idiom?
A type alias is a declaration that gives a type or type expression an alternative name without introducing a distinct nominal type. The newtype idiom creates a distinct type by wrapping an existing type, giving its values separate type-level identity while typically preserving their underlying representation.
What is type alias a kind of?
Type alias is a kind of type-level function. A function whose input and output are evaluated or interpreted in type positions to determine types.
What is type alias also called?
Type alias is also called Type aliases.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






