TypeScript's static typing catches many errors, but how do we ensure our type definitions themselves are correct? This talk introduces type testing and demonstrates its implementation using expect-type, a lightweight library for exactly this.
We'll cover:
- The concept of type testing and its importance in TypeScript projects
- A deep dive into expect-type's features and API
- Practical examples of using expect-type to catch subtle type errors
- Integrating expect-type into existing projects and CI pipelines
- Advanced use cases and best practices
Drawing from real-world scenarios, we'll explore how expect-type can be used as a standalone library, or through Vitest which bundles it natively, to enhance type safety and code quality.
Suitable for TypeScript developers of all levels, this talk will equip you with the tools and knowledge to write more robust, type-safe code using expect-type.
This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.
Comments