fix some type errors

This commit is contained in:
Johann150 2023-01-03 22:18:01 +01:00
parent 0c8a3cfeec
commit 08af6fda37
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
4 changed files with 4 additions and 4 deletions

View file

@ -140,7 +140,7 @@ async function connectDb(): Promise<void> {
}
async function spawnWorkers(clusterLimits: Required<Config['clusterLimits']>): Promise<void> {
const modes = ['web', 'queue'];
const modes = ['web' as const, 'queue' as const];
const cpus = os.cpus().length;
for (const mode of modes.filter(mode => clusterLimits[mode] > cpus)) {
bootLogger.warn(`configuration warning: cluster limit for ${mode} exceeds number of cores (${cpus})`);

View file

@ -22,7 +22,7 @@ export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'No
if (note.visibility === 'specified') return false;
// skip if the antenna creator is blocked by the note author
const blockings = await blockingCache.fetch(noteUser.id);
const blockings = (await blockingCache.fetch(noteUser.id)) ?? [];
if (blockings.some(blocking => blocking === antenna.userId)) return false;
if (note.visibility === 'followers') {

View file

@ -57,5 +57,5 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
await getMeta();
return cache;
return cache!;
}

View file

@ -126,7 +126,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({
const file = typeof src === 'object' ? src : await this.findOneBy({ id: src });
if (file == null) return null;
return await this.pack(file);
return await this.pack(file, opts);
},
async packMany(