The reason we use TypeScript is so that it can catch inadvertant bugs you or your teammate will inevitable make whether that's passing the wrong prop to a component or assuming the data coming in is of a certain type (or there at all!).
Simply using TypeScript and it's primitive types isn't enough to stop sneaky bugs from pestering you.
e.g. you wouldn't treat an email and a user Id that are both strings the same way, even though TypeScript wouldn't differentiate the two.
As your project matures, you need a type system that will mature with it so you can be confident in the code you ship.
This course addresses your code from a data modeling perspective and gives you tools to incrementally build models that make sense for your application.
You can introduce each pattern step by step and maximize the benefits you get from them.
Overview
Syllabus
- Understand the Downsides of Overusing Primitive Types
- Simplify TypeScript code Maintenance with Type Aliases
- Preserve Displaying TypeScript Type Alias Names
- Improve Readability by Annotating Types with JSDoc
- Provide Single Source of Truth for TypeScript Types using Lookups
- Make Primitive Types Incompatible using Typescript Structural Typing
- Validate Brand Typed Expressions with Custom Type Guards
- Create and Effectively Use TypeScript Brand Types
- Restrict Available Operations on Values using Value Objects
- Evolve your Data Model with Aliases, Brand Types and Value Objects
Taught by
Tomasz Ducin