diff --git a/src/JobRepository.ts b/src/JobRepository.ts index 52b49c77..a7690724 100644 --- a/src/JobRepository.ts +++ b/src/JobRepository.ts @@ -45,7 +45,6 @@ export class JobRepository /** * Initializes a new instance of the @see JobRepository class. - * * @param {EntityManager} manager The entity manager to use for the underlying repository. * @param {QueryRunner} queryRunner The query runner for the underlying repository. * @param {LoggerFactory} loggerFactory The logger factory to create a logger for the repo. @@ -64,7 +63,6 @@ export class JobRepository /** * Initializes the logger for this repository instance. - * * @param {Record} meta Additional data to attach to the logger instance. */ public initLogger(meta?: Record): void { @@ -97,8 +95,7 @@ export class JobRepository } cancellationToken?.throwIfCancelled(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const info = await this.insert(job as any); + const info = await this.insert(job as never); job.id = (info.identifiers[0] as { id: number }).id; this.logger?.info(`Added job ${job.id} with type ${job.type} due ${job.dueDate.toISOString()}.`); @@ -285,8 +282,7 @@ export class JobRepository cancellationToken?.throwIfCancelled(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - job = await this.manager.save(Job, job as any); + job = await this.manager.save(Job, job as Job); this.logger?.info( { jobId: job.id, runner: job.runner }, @@ -314,8 +310,7 @@ export class JobRepository job.successfulItems = null as unknown as undefined; job.failedItems = null as unknown as undefined; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - job = await this.manager.save(Job, job as any); + job = await this.manager.save(Job, job); this.logger?.info("Resetted job %d on runner %s", job.id, runnerName); diff --git a/test/JobRepository.test.ts b/test/JobRepository.test.ts index b0ac467a..ed094ec0 100644 --- a/test/JobRepository.test.ts +++ b/test/JobRepository.test.ts @@ -244,11 +244,13 @@ describe("JobRepository", () => { let transaction: (runInTransaction: (entityManager: EntityManager) => Promise) => Promise; beforeAll(() => { repo = getJobRepo(dataSource); + // eslint-disable-next-line @typescript-eslint/unbound-method transaction = repo.manager.transaction; }); afterAll(() => { if (repo) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore repo.manager.transaction = transaction; }