Partial
Partial<T>
returns a type that has the same properties as T
but all of them are optional. This is most useful when the strictNullChecks
flag is enabled. Partial
works on a single level, meaning it doesn’t affect nested objects. A good use case for Partial
is when you need to type a function that lets you override default values of properties of some object.
As you can see, Partial
is defined in a similar way to Readonly
. Instead of the readonly
modifier, the optionality modifier ?
is appended to each property of T
.
Get hands-on with 1400+ tech skills courses.