refactor: fix types

This commit is contained in:
syuilo 2023-02-12 18:47:30 +09:00
parent d7a2d59f41
commit 451bc0b444
24 changed files with 142 additions and 130 deletions

View file

@ -45,10 +45,10 @@ export class UserCacheService implements OnApplicationShutdown {
case 'userChangeSuspendedState':
case 'remoteUserUpdated': {
const user = await this.usersRepository.findOneByOrFail({ id: body.id });
this.userByIdCache.set(user.id, user);
this.userByIdCache.set(user.id, user as CacheableUser);
for (const [k, v] of this.uriPersonCache.cache.entries()) {
if (v.value?.id === user.id) {
this.uriPersonCache.set(k, user);
this.uriPersonCache.set(k, user as CacheableUser);
}
}
if (this.userEntityService.isLocalUser(user)) {
@ -78,7 +78,7 @@ export class UserCacheService implements OnApplicationShutdown {
@bindThis
public findById(userId: User['id']) {
return this.userByIdCache.fetch(userId, () => this.usersRepository.findOneByOrFail({ id: userId }));
return this.userByIdCache.fetch(userId, () => this.usersRepository.findOneByOrFail({ id: userId }) as Promise<CacheableUser>);
}
@bindThis