Say I have a type like this;
interface State {
one: string,
two: {
three: {
four: string
},
five: string
}
}
I make
You can pretty easily define your own RecursivePartial type, which will make all properties, included nested ones, optional:
type RecursivePartial = {
[P in keyof T]?: RecursivePartial;
};
If you only want some of your properties to be partial, then you can use this with an intersection and Pick:
type PartialExcept = RecursivePartial & Pick;
That would make everything optional except for the keys specified in the K parameter.