Say I have a type like this;
interface State {
one: string,
two: {
three: {
four: string
},
five: string
}
}
I make
For TypeScript 2.8 or later, the following type should fix problem about Array property.
type NestedPartial = {
[K in keyof T]?: T[K] extends Array ? Array> : NestedPartial
};
Please see the example below.
interface Foo {
NumProp: number;
SubItem: Foo;
SubItemArray: Foo[];
}
Valid Result with conditional type
Invalid Result
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html