Unleashing the Power of TypeScript
TypeScript 5.0 is a major advancement to the user-friendliness and flexibility of the language. It nudges us toward better coding practices, promotes cleaner code, and catches potential errors before they become a headache. It's a great time to start using TypeScript, but if you're a JavaS...
Other Authors: | |
---|---|
Format: | eBook |
Language: | Inglés |
Published: |
Cremorne, VIC :
SitePoint Pty. Ltd
[2023]
|
Subjects: | |
See on Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009784626006719 |
Table of Contents:
- Unleashing the Power of TypeScript
- Notice of Rights
- Notice of Liability
- Trademark Notice
- About SitePoint
- About the Author
- Preface
- Who Should Read This Book?
- Conventions Used
- Code Samples
- Tips, Notes, and Warnings
- Supplementary Materials
- Chapter 1: Simplifying Reducers in React with TypeScript
- Reducer Basics
- Adding Types to Our Reducer
- Adding Payloads to Actions
- Using Unions
- Removing the Default Case in the Reducer
- Dealing with Different Kinds of Actions
- Using Unions for Action Types
- Using Our Reducer in a React Component
- Conclusion
- Chapter 2: A Gentle Introduction to Generics in TypeScript
- What Are Generics?
- A Word on Naming Generics
- Extending Types in Generics
- Using Generics in Functions
- A Word on Using Generics with JSX
- Inferring Generics
- Taking It a Step Further
- Using Generics with Classes
- Conclusion
- Chapter 3: Navigating the Perils and Pitfalls of Using React's Context API with TypeScript
- The Fundamental Problem
- A Rejected Solution: Use any
- A Feasible Solution: Use a Type Assertion
- A Compromised Solution: Tell the Truth
- A Reasonable Solution: Create an Abstraction
- Creating Our Own createContext
- Using Our New Hook
- Conclusion
- Chapter 4: Extending DOM Elements and Creating Polymorphic Components
- Mirroring and Extending the Properties of an HTML Element
- Creating Composite Components
- Polymorphic Components
- Conclusion
- Chapter 5: A Guided Tour of the Three Biggest Features in TypeScript 5.0
- Decorators: the Next Generation
- Unleashing const Type Parameters
- Upgraded and Enhanced Enums
- Conclusion.