Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update DeepPartial for usage of generics with Repository class (#…
…8817) * test: test usage of generics with Repository class * test: cleanup * fix: update DeepPartial to work with generic Repository * fix: restore package-lock.json from typeorm/master
- Loading branch information
1 parent
ec27803
commit 8ba742e
Showing
2 changed files
with
43 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
/** | ||
* Same as Partial<T> but goes deeper and makes Partial<T> all its properties and sub-properties. | ||
*/ | ||
export type DeepPartial<T> = T extends Array<infer U> | ||
? DeepPartial<U>[] | ||
: T extends Map<infer K, infer V> | ||
? Map<DeepPartial<K>, DeepPartial<V>> | ||
: T extends Set<infer M> | ||
? Set<DeepPartial<M>> | ||
: T extends object | ||
? { [K in keyof T]?: DeepPartial<T[K]> } | ||
: T | ||
export type DeepPartial<T> = | ||
| T | ||
| (T extends Array<infer U> | ||
? DeepPartial<U>[] | ||
: T extends Map<infer K, infer V> | ||
? Map<DeepPartial<K>, DeepPartial<V>> | ||
: T extends Set<infer M> | ||
? Set<DeepPartial<M>> | ||
: T extends object | ||
? { [K in keyof T]?: DeepPartial<T[K]> } | ||
: T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters