refactor: 型エラー修正 / Fix type errors backend (#9983)
* refactor: fix type errors in backend * revert some changes * なるべくJS挙動を変えない方法に修正 * Update packages/backend/src/server/api/ApiCallService.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * コンフリクトするファイルを削除 --------- Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
parent
16ba1b3708
commit
ea92254b73
3 changed files with 5 additions and 5 deletions
|
@ -23,7 +23,7 @@ type pushNotificationsTypes = {
|
||||||
|
|
||||||
// Reduce length because push message servers have character limits
|
// Reduce length because push message servers have character limits
|
||||||
function truncateBody<T extends keyof pushNotificationsTypes>(type: T, body: pushNotificationsTypes[T]): pushNotificationsTypes[T] {
|
function truncateBody<T extends keyof pushNotificationsTypes>(type: T, body: pushNotificationsTypes[T]): pushNotificationsTypes[T] {
|
||||||
if (body === undefined) return body;
|
if (typeof body !== 'object') return body;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...body,
|
...body,
|
||||||
|
|
|
@ -108,9 +108,9 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
const [path] = await createTemp();
|
const [path] = await createTemp();
|
||||||
await pump(multipartData.file, fs.createWriteStream(path));
|
await pump(multipartData.file, fs.createWriteStream(path));
|
||||||
|
|
||||||
const fields = {} as Record<string, string | undefined>;
|
const fields = {} as Record<string, unknown>;
|
||||||
for (const [k, v] of Object.entries(multipartData.fields)) {
|
for (const [k, v] of Object.entries(multipartData.fields)) {
|
||||||
fields[k] = v.value;
|
fields[k] = typeof v === 'object' && 'value' in v ? v.value : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = fields['i'];
|
const token = fields['i'];
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { NotesRepository, UsersRepository } from '@/models/index.js';
|
import type { NotesRepository, UsersRepository } from '@/models/index.js';
|
||||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { LocalUser, RemoteUser, User } from '@/models/entities/User.js';
|
||||||
import type { Note } from '@/models/entities/Note.js';
|
import type { Note } from '@/models/entities/Note.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -45,7 +45,7 @@ export class GetterService {
|
||||||
throw new IdentifiableError('15348ddd-432d-49c2-8a5a-8069753becff', 'No such user.');
|
throw new IdentifiableError('15348ddd-432d-49c2-8a5a-8069753becff', 'No such user.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user as LocalUser | RemoteUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue