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.
Related Articles.
More from the engineering frontline.
Dive deep into our research and insights on design, development, and the impact of various trends to businesses.

Apr 24, 2026
RAG vs Fine-Tuning vs AI Agents: Which Architecture Fits Your Use Case
RAG, Fine-Tuning, or AI Agents? Use a proven decision framework to choose the right architecture for accuracy, cost control, and real outcomes.

Apr 24, 2026
How to Build a HIPAA-Ready AI Healthcare Product Without Slowing Delivery
AI healthcare products miss compliance reviews because of deferred decisions and poor architecture. This blog walks engineering leaders, product managers, and founders through practical patterns that keep delivery fast and compliance built in from the start.

Apr 23, 2026
Your AI Works in the Demo. It Will Not Survive Production Without Preparation
Why AI prototypes fail before reaching production, and the six readiness factors that determine whether they scale successfully.