From e2536db0e6f5cf0218e33900d0996caa4f88835d Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 14 Dec 2023 11:19:07 +0100 Subject: [PATCH] chore: fix some more types --- src/utils/detect-server-settings.ts | 12 ++++++------ src/utils/types.d.ts | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/utils/detect-server-settings.ts b/src/utils/detect-server-settings.ts index 942174ff167..10dbacd36f2 100644 --- a/src/utils/detect-server-settings.ts +++ b/src/utils/detect-server-settings.ts @@ -3,12 +3,17 @@ import { EOL } from 'os' import { dirname, relative, resolve } from 'path' import { getFramework, getSettings } from '@netlify/build-info' +import { OptionValues } from 'commander' import getPort from 'get-port' +import BaseCommand from '../commands/base-command.js' +import { DevConfig } from '../commands/dev/types.js' + import { detectFrameworkSettings } from './build-info.js' import { NETLIFYDEVWARN, chalk, log } from './command-helpers.js' import { acquirePort } from './dev.js' import { getPluginsToAutoInstall } from './init/utils.js' +import { ServerSettings } from './types.js' /** @param {string} str */ // @ts-expect-error TS(7006) FIXME: Parameter 'str' implicitly has an 'any' type. @@ -282,14 +287,9 @@ const handleForcedFramework = async ({ devConfig, project, workingDir, workspace /** * Get the server settings based on the flags and the devConfig - * @param {import('../commands/dev/types.js').DevConfig} devConfig - * @param {import('commander').OptionValues} flags - * @param {import('../commands/base-command.js').default} command - * @returns {Promise} */ -// @ts-expect-error TS(7006) FIXME: Parameter 'devConfig' implicitly has an 'any' type... Remove this comment to see the full error message -const detectServerSettings = async (devConfig, flags, command) => { +const detectServerSettings = async (devConfig: DevConfig, flags: OptionValues, command: BaseCommand): Promise => { validateProperty(devConfig, 'framework', 'string') /** @type {Partial} */ diff --git a/src/utils/types.d.ts b/src/utils/types.d.ts index a0157719070..23c5421abcf 100644 --- a/src/utils/types.d.ts +++ b/src/utils/types.d.ts @@ -40,7 +40,9 @@ export type ServerSettings = BaseServerSettings & { jwtSecret: string /** default 'app_metadata.authorization.roles' */ jwtRolePath: string - /** The port where the functions are running on */ + /** The port where the dev server is running on */ port: number + /** The port where the functions are running on */ + functionsPort: number https?: { key: string; cert: string; keyFilePath: string; certFilePath: string } }