Skip to content

Commit

Permalink
chore: fix ts build
Browse files Browse the repository at this point in the history
  • Loading branch information
cxtom committed May 21, 2021
1 parent dcfa510 commit dd63b3b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/cli/src/start/warmup.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {fastifyWarmup} from 'fastify-warmup';
import {join} from 'path';
import type {getApps} from '@hoth/app-autoload';
import type {AppConfig} from '@hoth/app-autoload';
import type {FastifyInstance} from 'fastify';

type UnPackReturnType<T> = T extends (...args: any[]) => Promise<infer U> ? U : T;

export async function warmup(apps: UnPackReturnType<typeof getApps>, fastifyInstance: FastifyInstance) {
export async function warmup(apps: AppConfig[], fastifyInstance: FastifyInstance) {
for (let i = 0; i < apps.length; i++) {
const app = apps[i];
if (app.warmupConfig) {
Expand All @@ -19,7 +17,7 @@ export async function warmup(apps: UnPackReturnType<typeof getApps>, fastifyInst
const routes = Object.keys(app.warmupConfig.warmupData);
const newWarmupData: Record<string, string | string[]> = {};
routes.forEach(route => {
newWarmupData[app.prefix + route] = app.warmupConfig.warmupData[route];
newWarmupData[app.prefix + route] = (app.warmupConfig.warmupData as Record<string, string | string[]>)[route];
});
app.warmupConfig.warmupData = newWarmupData;
}
Expand Down

0 comments on commit dd63b3b

Please sign in to comment.