From 849828b843de2b79424cc8cfdd759ce22cc0a6bd Mon Sep 17 00:00:00 2001 From: Dien Vu Date: Mon, 27 Feb 2023 16:32:50 +0700 Subject: [PATCH 1/3] Remove the unnecessary type. https://github.com/fastify/fastify-cli/issues/591 --- templates/app-ts/src/app.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/templates/app-ts/src/app.ts b/templates/app-ts/src/app.ts index c66bd714..f2300e01 100644 --- a/templates/app-ts/src/app.ts +++ b/templates/app-ts/src/app.ts @@ -1,15 +1,8 @@ import { join } from 'path'; import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload'; -import { FastifyPluginAsync } from 'fastify'; +import { FastifyPluginAsync, FastifyServerOptions } from 'fastify'; -export type AppOptions = { - // Place your custom options for app below here. -} & Partial; - - -// Pass --options via CLI arguments in command to enable these options. -const options: AppOptions = { -} +export type AppOptions = FastifyServerOptions & Partial; const app: FastifyPluginAsync = async ( fastify, From e11aa0e62b3b814e7f3c74c3c13f918f42c1a102 Mon Sep 17 00:00:00 2001 From: Dien Vu Date: Mon, 27 Feb 2023 17:11:01 +0700 Subject: [PATCH 2/3] Update app.ts --- templates/app-ts/src/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/app-ts/src/app.ts b/templates/app-ts/src/app.ts index f2300e01..6432c95f 100644 --- a/templates/app-ts/src/app.ts +++ b/templates/app-ts/src/app.ts @@ -4,6 +4,10 @@ import { FastifyPluginAsync, FastifyServerOptions } from 'fastify'; export type AppOptions = FastifyServerOptions & Partial; +// Pass --options via CLI arguments in command to enable these options. +const options: AppOptions = { +} + const app: FastifyPluginAsync = async ( fastify, opts From 6d975c1ee682ec74f72d5eef0b2dcde11b4681c8 Mon Sep 17 00:00:00 2001 From: Dien Vu Date: Mon, 27 Feb 2023 17:37:30 +0700 Subject: [PATCH 3/3] Improve the Typescript template. --- templates/app-ts/src/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/app-ts/src/app.ts b/templates/app-ts/src/app.ts index 6432c95f..58aabb66 100644 --- a/templates/app-ts/src/app.ts +++ b/templates/app-ts/src/app.ts @@ -2,8 +2,9 @@ import { join } from 'path'; import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload'; import { FastifyPluginAsync, FastifyServerOptions } from 'fastify'; -export type AppOptions = FastifyServerOptions & Partial; +export interface AppOptions extends FastifyServerOptions, Partial { +} // Pass --options via CLI arguments in command to enable these options. const options: AppOptions = { }