]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/typings/utils.ts
Remove uneccessary details to link titles
[github/Chocobozzz/PeerTube.git] / server / typings / utils.ts
index 4b5cf4d7e14d37b88fcb1706bc8845da3419ad75..55500d8c455712419cbfc0fa4a1865e926130316 100644 (file)
@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/array-type */
+
 export type FunctionPropertyNames<T> = {
   [K in keyof T]: T[K] extends Function ? K : never
 }[keyof T]
@@ -11,3 +13,12 @@ export type PickWith<T, KT extends keyof T, V> = {
 export type PickWithOpt<T, KT extends keyof T, V> = {
   [P in KT]?: T[P] extends V ? V : never
 }
+
+// https://github.com/krzkaczor/ts-essentials Rocks!
+export type DeepPartial<T> = {
+  [P in keyof T]?: T[P] extends Array<infer U>
+    ? Array<DeepPartial<U>>
+    : T[P] extends ReadonlyArray<infer U>
+      ? ReadonlyArray<DeepPartial<U>>
+      : DeepPartial<T[P]>
+}