Abstract
Generic types are placeholders for types that are resolved when a class or function is used, allowing type-safe code to be written that can deal with a range of different types, such as collection classes. This is a concept that is more easily demonstrated than explained, so I start this chapter with an example of the problem that generic types solve and then describe the basic ways that generic types are used. In Chapter 13, I describe the advanced generic type features that TypeScript provides. Table 12-1 summarizes the chapter.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsAuthor information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Adam Freeman
About this chapter
Cite this chapter
Freeman, A. (2019). Using Generic Types. In: Essential TypeScript. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4979-6_12
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4979-6_12
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4978-9
Online ISBN: 978-1-4842-4979-6
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)