Skip to content

Commit

Permalink
chore(repository): workaround for recursive DeepPartial
Browse files Browse the repository at this point in the history
error TS2321: Excessive stack depth comparing types 'DataObject<?>' and 'DataObject<?>'.
See microsoft/TypeScript#21592
  • Loading branch information
raymondfeng committed Aug 29, 2019
1 parent 9bcacb5 commit 7f1ea6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/repository/src/common-types.ts
Expand Up @@ -49,7 +49,11 @@ export interface AnyObject {
* An extension of the built-in Partial<T> type which allows partial values
* in deeply nested properties too.
*/
export type DeepPartial<T> = {[P in keyof T]?: DeepPartial<T[P]>};
// FIXME(rfeng): https://github.com/microsoft/TypeScript/issues/21592#issuecomment-496723647
// export type DeepPartial<T> = {[P in keyof T]?: DeepPartial<T[P]>};
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends never ? DeepPartial<T[P]> : DeepPartial<T[P]>;
};

/**
* Type alias for strongly or weakly typed objects of T
Expand Down

0 comments on commit 7f1ea6f

Please sign in to comment.