
TypeScript Utility Types Complete Guide
Typescript Utility types Utility types are helpers that typescript provides to make common type transformations easier. For example if you have a Todo type type Todo = { readonly id : number ; title : string ; description ?: string ; category ?: string ; status : " done " | " in-progress " | " todo " ; readonly createdAtTimestamp : number ; updatedAtTimestamp : number | null ; }; And you want to create a TodoPreview type that only has title , status properties. Instead of creating a new type by hardcoding it, you can use type TodoPreview = Pick < Todo , " title " | " status " > ; // type TodoPreview = { title: string; status: TaskStatus } You might think "So why don't I just hardcode it?" While hardcoding might work for small projects, it quickly becomes a Maintenance Nightmare in professional environments for two main reasons: Intent & Readability : As in larger types you have to manually compare the two types to figure out how they are related while Utility types make the relationshi
Continue reading on Dev.to
Opens in a new tab

![[Learning notes and hw] getting started with R-cnn: Manually implementing Intersection over Union (IoU)](/_next/image?url=https%3A%2F%2Fmedia2.dev.to%2Fdynamic%2Fimage%2Fwidth%3D800%252Cheight%3D%252Cfit%3Dscale-down%252Cgravity%3Dauto%252Cformat%3Dauto%2Fhttps%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Farticles%252Favit2emoxc0g68e5ltqj.jpg&w=1200&q=75)

