]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/utils.ts
Update README schemas
[github/Chocobozzz/PeerTube.git] / server / helpers / utils.ts
index 07c1b3f51adffa1b01e042d211c8cba465be309c..5b8d21f70d1cdfe0d9db79f7d625fae730184903 100644 (file)
@@ -22,8 +22,12 @@ function createEmptyCallback () {
   }
 }
 
-function getFormatedObjects (objects: any[], objectsTotal: number) {
-  const formatedObjects = []
+interface FormatableToJSON {
+  toFormatedJSON()
+}
+
+function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {
+  const formatedObjects: U[] = []
 
   objects.forEach(function (object) {
     formatedObjects.push(object.toFormatedJSON())