1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Type toActivityPubObject functions

This commit is contained in:
Chocobozzz 2019-08-21 14:31:57 +02:00
parent f92e7f76d4
commit b5fecbf441
No known key found for this signature in database
GPG key ID: 583A612D890159BE
24 changed files with 109 additions and 53 deletions

View file

@ -19,7 +19,10 @@ async function generateRandomString (size: number) {
return raw.toString('hex')
}
interface FormattableToJSON<U, V> { toFormattedJSON (args?: U): V }
interface FormattableToJSON<U, V> {
toFormattedJSON (args?: U): V
}
function getFormattedObjects<U, V, T extends FormattableToJSON<U, V>> (objects: T[], objectsTotal: number, formattedArg?: U) {
const formattedObjects = objects.map(o => o.toFormattedJSON(formattedArg))