
Learn best practices and advanced TypeScript tips for React development, including type-safe components, prop definitions, strict features, boundary validation, and type mapping with omit, pick, and readonly.
Meet the instructor behind best practices and advanced TypeScript tips for React devs. Maurice de Boer, a frontend-focused full-stack developer and Microsoft MVP, shares his background and how to connect.
Begin by installing Node.js, npm, and Git, verify versions with node --version, npm --version, and git --version, and use the slides and GitHub repo with commit-by-commit steps to practice.
clone the GitHub repository, install npm packages, switch to the zero zero start branch, and run the dev server on localhost:3000 to explore the Next.js TypeScript project.
Learn to compile and type check TypeScript in React apps using tsc, with compile and watch commands, plus pre-commit hooks to catch errors early.
Learn how to convert JavaScript React components to TypeScript by typing props with interfaces or types, renaming to .tsx, and using functional components or React FC with proper return types.
Define mutually exclusive props for a component in TypeScript by requiring either a message or a message ID, not both, and use never types to enforce the rule.
Enable TypeScript strict mode and no unchecked index access to catch runtime errors, illustrated with a pizza order demo using coalescing and explicit error handling.
Validate data at the application boundary using schemas to ensure runtime shapes match expectations, catching errors from rest endpoints before rendering, and plan to infer TypeScript types from schemas later.
Learn to infer TypeScript types for functions using generics, keyof, and type extraction from configuration objects, providing compile-time validation and safer runtime access.
Explore building generic React form components with TypeScript by typing generic props and values to match initial values and submissions, enforcing type safety and preventing undefined values.
Derive component prop types from existing components by inferring prop definitions via React's component props, enabling reusable, generic type mappings for inputs and checkboxes.
Infer TypeScript types directly from Zod schemas to keep runtime validation and compile-time types in sync, avoid duplication, and align pizza schemas.
Explore TypeScript type mappings with Omit and Pick to create new types from existing ones, using conditional logic to include or omit properties and keep data in sync.
Explore the read only type in TypeScript, how it prevents mutations, its non-recursive nature, and how to catch bugs with compile-time checks in React apps.
Master recursive type mappings in TypeScript by creating a deep read-only type to make nested data immutable and detect mutations at compile time.
Explore how to display complex TypeScript mapped types using a resolve type mapping to improve readability in hover tooltips and error messages, while preserving read-only properties.
Explore type predicate functions in TypeScript to achieve both compile-time and runtime type safety by guarding items on sale such as books, magazines, and pens.
Learn type assertion functions and how they differ from type predicate functions, throwing runtime errors to enforce types and simplify code in TypeScript for React developers.
Master exhaustive checking in TypeScript by covering all union cases with switches and the never type, while enforcing runtime safety with assert never.
Explore end-of-course highlights: map types, TypeScript types, and flexible React components with complex props. Emphasize exhaustive checks and runtime type validations at the boundary.
Are you tired of dealing with runtime bugs in your React applications? Want to improve the reliability and efficiency of your code without a lot of extra effort? Look no further! In this interactive course, I'll be sharing simple techniques and settings to enhance your TypeScript usage when developing React applications.
By utilizing TypeScript's ability to check our code, we can catch potential errors early on in the development process. This not only saves time, but also leads to a better user experience as bugs are less likely to reach production.
We'll start by diving into the basics of declaring React components using TypeScript, and then move on to more advanced concepts such as using types like any, unknown and never, type predicates, and exhaustive checking. You'll also learn about built-in mapped types and how to create your own custom type maps. Plus, we'll explore the power of conditional types and type inferring in the TypeScript type system.
By the end of this course, you'll have the skills and knowledge to take your React applications to the next level, making them more reliable and efficient than ever before. Don't miss this opportunity to improve your development skills and create a better user experience. Enroll today!