From 0ac1fc846b01c544c0185e4c33012b95463452b6 Mon Sep 17 00:00:00 2001
From: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com>
Date: Sat, 11 Mar 2023 08:51:37 +0900
Subject: [PATCH] =?UTF-8?q?refactor(backend):=20=E5=BF=85=E8=A6=81?=
 =?UTF-8?q?=E3=81=AA=E3=81=84as=20any=E3=82=92=E6=B6=88=E5=8E=BB=20(#10293?=
 =?UTF-8?q?)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/backend/src/core/SignupService.ts                     | 2 +-
 packages/backend/src/core/activitypub/ApInboxService.ts        | 2 +-
 packages/backend/src/core/activitypub/models/ApNoteService.ts  | 2 +-
 packages/backend/src/core/activitypub/type.ts                  | 3 ++-
 packages/backend/src/queue/processors/InboxProcessorService.ts | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/packages/backend/src/core/SignupService.ts b/packages/backend/src/core/SignupService.ts
index 90a7186909..d7bc05b8bd 100644
--- a/packages/backend/src/core/SignupService.ts
+++ b/packages/backend/src/core/SignupService.ts
@@ -90,7 +90,7 @@ export class SignupService {
 					cipher: undefined,
 					passphrase: undefined,
 				},
-			} as any, (err, publicKey, privateKey) =>
+			}, (err, publicKey, privateKey) =>
 				err ? rej(err) : res([publicKey, privateKey]),
 			));
 	
diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts
index 6d9569bce2..055bffe731 100644
--- a/packages/backend/src/core/activitypub/ApInboxService.ts
+++ b/packages/backend/src/core/activitypub/ApInboxService.ts
@@ -140,7 +140,7 @@ export class ApInboxService {
 		} else if (isFlag(activity)) {
 			await this.flag(actor, activity);
 		} else {
-			this.logger.warn(`unrecognized activity type: ${(activity as any).type}`);
+			this.logger.warn(`unrecognized activity type: ${activity.type}`);
 		}
 	}
 
diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts
index 6596d35be2..28bcbc6fab 100644
--- a/packages/backend/src/core/activitypub/models/ApNoteService.ts
+++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts
@@ -124,7 +124,7 @@ export class ApNoteService {
 			throw new Error('invalid note');
 		}
 	
-		const note: IPost = object as any;
+		const note = object as IPost;
 	
 		this.logger.debug(`Note fetched: ${JSON.stringify(note, null, 2)}`);
 
diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts
index 7f2ca9c05e..8851946330 100644
--- a/packages/backend/src/core/activitypub/type.ts
+++ b/packages/backend/src/core/activitypub/type.ts
@@ -195,7 +195,8 @@ export const isPropertyValue = (object: IObject): object is IApPropertyValue =>
 	object &&
 	getApType(object) === 'PropertyValue' &&
 	typeof object.name === 'string' &&
-	typeof (object as any).value === 'string';
+	'value' in object &&
+	typeof object.value === 'string';
 
 export interface IApMention extends IObject {
 	type: 'Mention';
diff --git a/packages/backend/src/queue/processors/InboxProcessorService.ts b/packages/backend/src/queue/processors/InboxProcessorService.ts
index 33d6f4eafa..41fe06b7c3 100644
--- a/packages/backend/src/queue/processors/InboxProcessorService.ts
+++ b/packages/backend/src/queue/processors/InboxProcessorService.ts
@@ -64,7 +64,7 @@ export class InboxProcessorService {
 		const activity = job.data.activity;
 
 		//#region Log
-		const info = Object.assign({}, activity) as any;
+		const info = Object.assign({}, activity);
 		delete info['@context'];
 		this.logger.debug(JSON.stringify(info, null, 2));
 		//#endregion