Búsqueda de sitios web

typescript - error TS2322: El tipo 'DeepPartial[]' no se puede asignar al tipo 'T[]'


El siguiente código TypeScript

import { Repository } from 'typeorm'

const save = async <T>(repo: Repository<T>, entities: T[]): Promise<T[]> => {
  return await repo.save(map((entity) => omit(['createdAt', 'updatedAt'], entity))(entities))
}

genera el siguiente error

src/database/dao/user/user.dao.ts:46:3 - error TS2322: Type 'DeepPartial<T>[]' is not assignable to type 'T[]'.
Type 'DeepPartial<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'DeepPartial<T>'.
  • typescript: 4.7.3
  • typeorm: 0.2.45

Soy bastante nuevo en TypeScript y TypeORM, cualquier ayuda es apreciada.