Skip to content

Commit d656c54

Browse files
committed
chore(repository): workaround for recursive DeepPartial
error TS2321: Excessive stack depth comparing types 'DataObject<?>' and 'DataObject<?>'. See microsoft/TypeScript#21592
1 parent 6d333e7 commit d656c54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/repository/src/common-types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ export interface AnyObject {
4949
* An extension of the built-in Partial<T> type which allows partial values
5050
* in deeply nested properties too.
5151
*/
52-
export type DeepPartial<T> = {[P in keyof T]?: DeepPartial<T[P]>};
52+
// FIXME(rfeng): https://github.com/microsoft/TypeScript/issues/21592#issuecomment-496723647
53+
// export type DeepPartial<T> = {[P in keyof T]?: DeepPartial<T[P]>};
54+
export type DeepPartial<T> = {
55+
[P in keyof T]?: T[P] extends never ? DeepPartial<T[P]> : DeepPartial<T[P]>;
56+
};
5357

5458
/**
5559
* Type alias for strongly or weakly typed objects of T

0 commit comments

Comments
 (0)