diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index e61061f41c..fb434b9a41 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "lib": ["dom", "ES2022"], - "target": "ES2022", + "lib": ["dom", "ESNext"], + "target": "ESNext", "types": ["cypress", "node"], "incremental": true, "skipLibCheck": true, diff --git a/packages/backend/src/core/HttpRequestService.ts b/packages/backend/src/core/HttpRequestService.ts index 3b3e72d2e3..8000f1fd6c 100644 --- a/packages/backend/src/core/HttpRequestService.ts +++ b/packages/backend/src/core/HttpRequestService.ts @@ -73,7 +73,7 @@ export function validateSocketConnect(allowedPrivateNetworks: PrivateNetwork[] | declare module 'node:http' { interface Agent { - createConnection(options: net.NetConnectOpts, callback?: (err: unknown, stream: net.Socket) => void): net.Socket; + createConnection(options: net.NetConnectOpts, callback?: (err: Error | null, stream: net.Socket) => void): net.Socket; } } @@ -86,7 +86,7 @@ class HttpRequestServiceAgent extends http.Agent { } @bindThis - public createConnection(options: net.NetConnectOpts, callback?: (err: unknown, stream: net.Socket) => void): net.Socket { + public createConnection(options: net.NetConnectOpts, callback?: (err: Error | null, stream: net.Socket) => void): net.Socket { const socket = super.createConnection(options, callback) .on('connect', () => { if (process.env.NODE_ENV === 'production') { @@ -106,7 +106,7 @@ class HttpsRequestServiceAgent extends https.Agent { } @bindThis - public createConnection(options: net.NetConnectOpts, callback?: (err: unknown, stream: net.Socket) => void): net.Socket { + public createConnection(options: net.NetConnectOpts, callback?: (err: Error | null, stream: net.Socket) => void): net.Socket { const socket = super.createConnection(options, callback) .on('connect', () => { if (process.env.NODE_ENV === 'production') { diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts index 486af69f3a..07ee8f3931 100644 --- a/packages/backend/src/core/QueueService.ts +++ b/packages/backend/src/core/QueueService.ts @@ -896,7 +896,7 @@ export class QueueService implements OnModuleInit { @bindThis public async queueRetryJob(queueType: typeof QUEUE_TYPES[number], jobId: string) { const queue = this.getQueue(queueType); - const job: Bull.Job | null = await queue.getJob(jobId); + const job: Bull.Job | undefined = await queue.getJob(jobId); if (job) { if (job.finishedOn != null) { await job.retry(); @@ -909,7 +909,7 @@ export class QueueService implements OnModuleInit { @bindThis public async queueRemoveJob(queueType: typeof QUEUE_TYPES[number], jobId: string) { const queue = this.getQueue(queueType); - const job: Bull.Job | null = await queue.getJob(jobId); + const job: Bull.Job | undefined = await queue.getJob(jobId); if (job) { await job.remove(); } @@ -943,7 +943,7 @@ export class QueueService implements OnModuleInit { @bindThis public async queueGetJob(queueType: typeof QUEUE_TYPES[number], jobId: string) { const queue = this.getQueue(queueType); - const job: Bull.Job | null = await queue.getJob(jobId); + const job: Bull.Job | undefined = await queue.getJob(jobId); if (job) { return this.packJobData(job); } else { diff --git a/packages/backend/src/server/api/mastodon/MastodonLogger.ts b/packages/backend/src/server/api/mastodon/MastodonLogger.ts index 5ea69ed151..dda9fcfd6b 100644 --- a/packages/backend/src/server/api/mastodon/MastodonLogger.ts +++ b/packages/backend/src/server/api/mastodon/MastodonLogger.ts @@ -67,7 +67,7 @@ export function getErrorException(error: unknown): Error | null { } // This is the inner exception, basically - if (error.cause && !isAxiosError(error.cause)) { + if (error.cause instanceof Error && !isAxiosError(error.cause)) { if (!error.cause.stack) { error.cause.stack = error.stack; } @@ -150,7 +150,7 @@ function unpackAxiosError(error: unknown): unknown { return undefined; } - if (error.cause && !isAxiosError(error.cause)) { + if (error.cause instanceof Error && !isAxiosError(error.cause)) { if (!error.cause.stack) { error.cause.stack = error.stack; } diff --git a/packages/backend/test-federation/test/utils.ts b/packages/backend/test-federation/test/utils.ts index b155103efa..62ed1ce518 100644 --- a/packages/backend/test-federation/test/utils.ts +++ b/packages/backend/test-federation/test/utils.ts @@ -196,7 +196,7 @@ export async function uploadFile( body.append('name', filename); return await fetch(`https://${host}/api/drive/files/create`, { method: 'POST', body }) - .then(async res => await res.json()); + .then(async res => await res.json() as Misskey.entities.DriveFile); } export async function addCustomEmoji( diff --git a/packages/backend/test-federation/tsconfig.json b/packages/backend/test-federation/tsconfig.json index df2d4bb97d..40fbfa3bb0 100644 --- a/packages/backend/test-federation/tsconfig.json +++ b/packages/backend/test-federation/tsconfig.json @@ -11,8 +11,8 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */