fix type errors caused by dependency updates

This commit is contained in:
Hazelnoot 2025-09-24 03:06:16 -04:00
parent 5234b92898
commit 681afb2d9f
6 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
{
"compilerOptions": {
"lib": ["dom", "ES2022"],
"target": "ES2022",
"lib": ["dom", "ESNext"],
"target": "ESNext",
"types": ["cypress", "node"],
"incremental": true,
"skipLibCheck": true,

View file

@ -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') {

View file

@ -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 {

View file

@ -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;
}

View file

@ -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(

View file

@ -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. */