SitePoint
Blog
Forum
Library
Login
Join Premium
Toggle sidebar
Unleashing the Power of TypeScript
Toggle community discussions
Close
Content
Files
Bookmarks
Preface
Unleashing the Power of TypeScript
Notice of Rights
Notice of Liability
Trademark Notice
About the Author
About SitePoint
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 Our Reducer in a React Component
Conclusion
A Gentle Introduction to Generics in TypeScript
What Are Generics?
A Word on Naming Generics
Extending Types in Generics
Using Generics in Functions
Inferring Generics
Taking It a Step Further
Using Generics with Classes
Conclusion
Navigating Around 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
Conclusion
Extending DOM Elements and Creating Polymorphic Components
Mirroring and Extending the Properties of an HTML Element
Polymorphic Components
Conclusion
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
Open text modal
Community Questions
Close