Unleashing the Power of TypeScript
If you're a JavaScript developer struggling to get to grips with TypeScript or use it effectively in your projects, this book will guide you in making the most of this powerful language and its latest features, and help you overcome some common misunderstandings and pitfalls. TypeScript 5.0 is...
Saved in:
| Main Author: | |
|---|---|
| Format: | eBook |
| Language: | English |
| Published: |
La Vergne
SitePoint
2023
SitePoint Pty, Limited |
| Edition: | 1 |
| Subjects: | |
| ISBN: | 9781925836585, 1925836584 |
| Online Access: | Get full text |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
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

