Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
TypeScript Indexed Access Types: Deriving Types from Existing Ones with T["key"]
We look at reading a property's type with T["key"], union indexes, getting an array's element type with T[number], T[K] in generics and deriving pieces from large API types.
Generic Interfaces, Types and Classes in TypeScript: Box, Result and Stack
We move type parameters from functions to types: Box<T> as a generic type alias, a paginated list as a generic interface, Result<T, E> for success and failure, and generic Stack and Registry classes.
Generic Constraints in TypeScript: extends, Default Types, const and NoInfer
We constrain type parameters with extends, tie two parameters together with keyof, use default type parameters, and steer inference with TS 5.0 const type parameters and TS 5.4 NoInfer.
Introduction to Generics in TypeScript: Taking the Type as a Parameter
Why generic functions exist, how a type parameter ties input to output, how TypeScript infers T, and how generics differ from any and unknown, with small examples.