Skip to content

Commit

Permalink
Fix DeepPartial type
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaKhD committed Sep 29, 2022
1 parent e76e18e commit 9c85872
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions js/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ export type Xor<T1, T2 = never, T3 = never, T4 = never, T5 = never, T6 = never,
| Seal<T8, KeysOf<T1, T2, T3, T4, T5, T6, T7, T9>>
| Seal<T9, KeysOf<T1, T2, T3, T4, T5, T6, T7, T8>>;

export type DeepPartial<T> = T extends object ? {
[P in keyof T]?: T[P] extends Function ? T[P] : DeepPartial<T[P]>;
} : T;
type Scalar = string | number | Function | Date | Boolean | Array<unknown>;
export type DeepPartial<T> = T extends Scalar ? T : {
[P in keyof T]?: DeepPartial<T[P]>;
};

type ItemType<T> = T extends (infer TItem)[] ? TItem : T;
type Property<T, TPropName extends string> = T extends Partial<Record<TPropName, infer TValue>> ? TValue : never;
Expand Down
14 changes: 9 additions & 5 deletions ts/dx.all.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1676,11 +1676,11 @@ declare module DevExpress.core {
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export type DeepPartial<T> = T extends object
? {
[P in keyof T]?: T[P] extends Function ? T[P] : DeepPartial<T[P]>;
}
: T;
export type DeepPartial<T> = T extends Scalar
? T
: {
[P in keyof T]?: DeepPartial<T[P]>;
};
export type DefaultOptionsRule<T> = {
device?: Device | Device[] | ((device: Device) => boolean);
options: DeepPartial<T>;
Expand Down Expand Up @@ -1757,6 +1757,10 @@ declare module DevExpress.core {
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
interface PromiseType<T> extends JQueryPromise<T> {}
/**
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
type Scalar = string | number | Function | Date | Boolean | Array<unknown>;
/**
* [descr:template]
*/
Expand Down

0 comments on commit 9c85872

Please sign in to comment.