Template Literal Types in TypeScript Through Examples
Use template literal types to generate key names, parse route parameters, and write type-safe event emitters, along with type testing with Vitest and pitfalls to avoid.
Use template literal types to generate key names, parse route parameters, and write type-safe event emitters, along with type testing with Vitest and pitfalls to avoid.
Which checks the strict flag in tsconfig enables, what errors each check catches, which additional flags to enable besides strict, and how to migrate an old project to strict.
Use keyof, typeof, and indexed access types to infer types from existing data, reduce code duplication, and let the compiler catch incorrect keys for you.
How to configure tsconfig and package.json so your TypeScript library generates proper .d.ts files with complete types for users and can be tested with Vitest.
How to type async functions, using Promise<T>, Awaited, Promise.all, safe error handling, and avoiding common pitfalls with async callbacks.
Comparing enum and union string literal in TypeScript for runtime, type safety, and tooling, with the `as const` pattern and criteria for each situation.
Use Zod to validate data from APIs, forms, and environment variables at runtime, while inferring TypeScript types from the same schema.
Use mapped types and conditional types to automatically generate types from existing types, including infer, key remapping, type testing, and common pitfalls.
Guide to setting up tsconfig.json for new TypeScript projects, covering strict mode, NodeNext module, separating build/test configurations, and common pitfalls.
How to use type guard (x is T) and assertion function (asserts x is T) to safely narrow types, validate unknown data, and avoid common pitfalls.
Use discriminated unions to model state and API responses, letting the compiler block invalid states and remind you to handle all cases.
Differentiate any, unknown, and never in TypeScript with concrete examples: when to use, when to avoid, and exhaustive checking patterns.
Learn how to combine types with union and intersection, and how TypeScript narrows types to write safer code with fewer runtime errors.
Learn how to use Partial, Pick, Omit, and Record to reuse types and reduce duplicate interfaces in TypeScript.
Understand TypeScript generics through everyday examples like Repository, ApiResponse, Cache — no dry theory, just runnable code and illustrative tests.