mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Stricter models typing
This commit is contained in:
parent
9a320a06b6
commit
16c016e8b1
54 changed files with 148 additions and 95 deletions
|
@ -68,7 +68,7 @@ function transactionRetryer <T> (func: (err: any, data: T) => any) {
|
|||
})
|
||||
}
|
||||
|
||||
function updateInstanceWithAnother <T extends Model<T>> (instanceToUpdate: Model<T>, baseInstance: Model<T>) {
|
||||
function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanceToUpdate: T, baseInstance: U) {
|
||||
const obj = baseInstance.toJSON()
|
||||
|
||||
for (const key of Object.keys(obj)) {
|
||||
|
@ -88,7 +88,7 @@ function afterCommitIfTransaction (t: Transaction, fn: Function) {
|
|||
return fn()
|
||||
}
|
||||
|
||||
function deleteNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean } & Model<T>> (
|
||||
function deleteNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean } & Pick<Model, 'destroy'>> (
|
||||
fromDatabase: T[],
|
||||
newModels: T[],
|
||||
t: Transaction
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue