Jan 4, 2023
Typescript: Utility Types
Typescript comes with some handy utility types. In this blog, we will be exploring exactly that.
Author


Book a call
Table of Contents
Developers frequently claim that typescript requires them to write redundant code. The reasons can vary, but one of the most common is a failure to use utility types.
Types are analogous to utility functions in Javascript.
They are provided in typescript to make our lives easier. Let's take a look at them one at a time.
1. Partial
Partial<T> allows you to create optional props with a single line of code. Without it, we'd need to duplicate the User type, which isn't ideal.
Below is an example of Partial utility type.
Partial takes type as an argument.
2. Required
Required<T> is the inverse of Partial. It creates all the necessary props.
Required also takes type as an argument.
3. Readonly
In JavaScript, readonly functions similarly to const. You cannot reassign a type once it has been marked as readonly.
4. NonNullable
NonNullable<T> filters your type and removes null and undefined from the union of types.
5. Exclude
Exclude<T, K> lets you remove type from the union types.
It takes two arguments. The first is type, while the second is a union of props.
6. Extract
Extract<T, K> is the inverse of Exclude. It will generate union types based on the specified union type.
7. Pick
Pick<T, K> picks props from type. It will give you a new type.
8. Omit
Omit<T, K> removes props from types.
9. ReturnType
ReturnType<T> gives return type of function.
10. Record
Record<T, K>creates an object type.
Instead of doing this:
You can do this:
Record also accepts union type as key that is not supported by interface and type.
As we can see, utility types help in avoiding redundancy in the codebase. It also enables maintaining a single source of truth.
That's it for today. I hope you enjoyed this blog. Stay tuned for upcoming blogs on the typescript.
Subscribe to Our Newsletter
Subscribe to RSS
Press & Media Hub RSS FeedRelated Articles.
More from the engineering frontline.
Dive deep into our research and insights on design, development, and the impact of various trends to businesses.

Jun 4, 2026
The Cost of Delaying Production Readiness in AI Fintech Product Development
This blog examines why production readiness in fintech AI gets deprioritized during the build, the business cost of addressing it late, and how a readiness-first approach changes the outcome.

Jun 4, 2026
Beyond Virtual Consultations: Building Production-Ready AI Telehealth Products for Monitoring, Triage, and Patient Engagement
A decision framework for healthcare enterprises and healthtech startups building production-ready AI telehealth platforms, covering architecture, triage, engagement, integrations, and compliance in one guide.

Jun 4, 2026
From AI Pilots to Production: Building Enterprise-Ready Lending Platforms for Underwriting and Risk Scoring
Why AI lending pilots stall before they scale, and what it takes to build a production-grade underwriting and risk scoring platform.