Skip to content

Commit

Permalink
Merge pull request #6 from HotoRas/fix/tests
Browse files Browse the repository at this point in the history
Add some refactors
  • Loading branch information
HotoRas authored Aug 3, 2024
2 parents 85f47e0 + a6ddcb7 commit 774e44e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/core/AiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class AiService {
}

const buffer = await fs.promises.readFile(path);
const image = await tf.node.decodeImage(buffer, 3) as any;
const image = await tf.node.decodeImage(buffer, 3) as tf.Tensor3D;
try {
const predictions = await this.model.classify(image);
return predictions;
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/core/CustomEmojiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
@bindThis
public async populateEmojis(emojiNames: string[], noteUserHost: string | null): Promise<Record<string, string>> {
const emojis = await Promise.all(emojiNames.map(x => this.populateEmoji(x, noteUserHost)));
const res = {} as any;
const res: {emojiNames: string[]} = {};
for (let i = 0; i < emojiNames.length; i++) {
if (emojis[i] != null) {
res[emojiNames[i]] = emojis[i];
Expand All @@ -373,7 +373,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
@bindThis
public async prefetchEmojis(emojis: { name: string; host: string | null; }[]): Promise<void> {
const notCachedEmojis = emojis.filter(emoji => this.cache.get(`${emoji.name} ${emoji.host}`) == null);
const emojisQuery: any[] = [];
const emojisQuery: [{ name: FindOperator<string>, host: string | null }] = [];
const hosts = new Set(notCachedEmojis.map(e => e.host));
for (const host of hosts) {
if (host == null) continue;
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/core/DriveService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type AddFileArgs = {
/** Comment */
comment?: string | null;
/** Folder ID */
folderId?: any;
folderId?: MiDriveFolder['id'] | null;
/** If set to true, forcibly upload the file even if there is a file with the same hash. */
force?: boolean;
/** Do not save file to local */
Expand Down Expand Up @@ -817,7 +817,7 @@ export class DriveService {
} as DeleteObjectCommandInput;

await this.s3Service.delete(meta, param);
} catch (err: any) {
} catch (err: unknown) {
if (err.name === 'NoSuchKey') {
this.deleteLogger.warn(`The object storage had no such key to delete: ${key}. Skipping this.`, err as Error);
return;
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,17 @@ class MyCustomLogger implements Logger {
}

@bindThis
public logQuery(query: string, parameters?: any[]) {
public logQuery(query: string, parameters?: unknown) {
sqlLogger.info(this.highlight(query));
}

@bindThis
public logQueryError(error: string, query: string, parameters?: any[]) {
public logQueryError(error: string, query: string, parameters?: unknown) {
sqlLogger.error(this.highlight(query));
}

@bindThis
public logQuerySlow(time: number, query: string, parameters?: any[]) {
public logQuerySlow(time: number, query: string, parameters?: unknown) {
sqlLogger.warn(this.highlight(query));
}

Expand Down

0 comments on commit 774e44e

Please sign in to comment.