Skip to main content

RecursivePartial

@elastic/chartsExports


@elastic/charts / RecursivePartial

Type alias: RecursivePartial<T>

RecursivePartial<T>: { [P in keyof T]?: T[P] extends NonAny[] ? T[P] : T[P] extends ReadonlyArray<NonAny> ? T[P] : T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<RecursivePartial<U>> : T[P] extends Set<infer V> ? Set<RecursivePartial<V>> : T[P] extends Map<infer K, infer V> ? Map<K, RecursivePartial<V>> : T[P] extends NonAny ? T[P] : IsUnknown<T[P], 1, 0> extends 1 ? T[P] : RecursivePartial<T[P]> }

Replaces all properties on any type as optional, includes nested types

example:

interface Person {
name: string;
age?: number;
spouse: Person;
children: Person[];
}
type PartialPerson = RecursivePartial<Person>;
// results in
interface PartialPerson {
name?: string;
age?: number;
spouse?: RecursivePartial<Person>;
children?: RecursivePartial<Person>[]
}

Type parameters

T

Source

packages/charts/src/utils/common.tsx:207


Generated using typedoc-plugin-markdown and TypeDoc