Skip to content

Commit

Permalink
docs: fix recursive partial
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 committed Mar 17, 2021
1 parent d74fd8f commit 6872fe1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
17 changes: 16 additions & 1 deletion api/charts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,16 @@ export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn;
// @public (undocumented)
export const INPUT_KEY = "inputIndex";

// Warning: (ae-missing-release-tag) "IsAny" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type IsAny<T, True, False = never> = True | False extends (T extends never ? True : False) ? True : False;

// Warning: (ae-missing-release-tag) "IsUnknown" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;

// Warning: (ae-missing-release-tag) "Key" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1426,6 +1436,11 @@ export interface NodeDescriptor {
[AGGREGATE_KEY]: number;
}

// Warning: (ae-missing-release-tag) "NonAny" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type NonAny = number | boolean | string | symbol | null;

// Warning: (ae-missing-release-tag) "Opacity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1733,7 +1748,7 @@ export interface RectStyle {
//
// @public
export type RecursivePartial<T> = {
[P in keyof T]?: RecursivePartial<T[P]>;
[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]>;
};

// Warning: (ae-missing-release-tag) "RenderChangeListener" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function getTooltipInfo(
value,
formattedValue: `${valueFormatter(value)} (${percentFormatter(percentValueGetter(shape))})`,
valueAccessor: shape.depth,
// the datum is omitted due to his aggregated and nested nature
// the datum is omitted ATM due to the aggregated and nested nature of a partition section
});
});

Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export {
VerticalAlignment,
HorizontalAlignment,
RecursivePartial,
NonAny,
IsAny,
IsUnknown,
ColorVariant,
Color,
LabelAccessor,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export type IsAny<T, True, False = never> = True | False extends (T extends neve
// return True if T is `unknown`, otherwise return False
export type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;

type NonAny = number | boolean | string | symbol | null;
export type NonAny = number | boolean | string | symbol | null;

export interface MergeOptions {
/**
Expand Down

0 comments on commit 6872fe1

Please sign in to comment.