diff --git a/src/commands/deploy/deploy.ts b/src/commands/deploy/deploy.ts index 1a5ab4f012e..d5d9ce70813 100644 --- a/src/commands/deploy/deploy.ts +++ b/src/commands/deploy/deploy.ts @@ -411,7 +411,6 @@ const runDeploy = async ({ deployToProduction, // @ts-expect-error TS(7031) FIXME: Binding element 'functionsConfig' implicitly has a... Remove this comment to see the full error message functionsConfig, - // @ts-expect-error TS(7031) FIXME: Binding element 'functionsFolder' implicitly has a... Remove this comment to see the full error message functionsFolder, // @ts-expect-error TS(7031) FIXME: Binding element 'options' implicitly has an 'a... Remove this comment to see the full error message options, @@ -429,6 +428,8 @@ const runDeploy = async ({ skipFunctionsCache, // @ts-expect-error TS(7031) FIXME: Binding element 'title' implicitly has an 'any' ty... Remove this comment to see the full error message title, +}: { + functionsFolder?: string }) => { let results let deployId @@ -444,13 +445,14 @@ const runDeploy = async ({ results = await api.createSiteDeploy({ siteId, title, body: { draft, branch: alias } }) deployId = results.id - // @ts-expect-error TS(2345) FIXME: Argument of type '{ base: any; packagePath: any; }... Remove this comment to see the full error message const internalFunctionsFolder = await getInternalFunctionsDir({ base: site.root, packagePath }) // The order of the directories matter: zip-it-and-ship-it will prioritize // functions from the rightmost directories. In this case, we want user // functions to take precedence over internal functions. - const functionDirectories = [internalFunctionsFolder, functionsFolder].filter(Boolean) + const functionDirectories = [internalFunctionsFolder, functionsFolder].filter((folder): folder is string => + Boolean(folder), + ) const manifestPath = skipFunctionsCache ? null : await getFunctionsManifestPath({ base: site.root, packagePath }) const redirectsPath = `${deployFolder}/_redirects` @@ -475,11 +477,10 @@ const runDeploy = async ({ uploadDeployBlobs({ deployId, siteId, silent, options, cachedConfig: command.netlify.cachedConfig }) results = await deploySite(api, siteId, deployFolder, { + // @ts-expect-error FIXME config, - // @ts-expect-error TS(2322) FIXME: Type 'any[]' is not assignable to type 'never[]'. fnDir: functionDirectories, functionsConfig, - // @ts-expect-error TS(2322) FIXME: Type '(event: any) => void' is not assignable to t... Remove this comment to see the full error message statusCb: silent ? () => {} : deployProgressCb(), deployTimeout, syncFileLimit: SYNC_FILE_LIMIT, @@ -732,6 +733,7 @@ const prepAndRunDeploy = async ({ }) const results = await runDeploy({ + // @ts-expect-error FIXME alias, api, command, diff --git a/src/lib/functions/server.ts b/src/lib/functions/server.ts index 05aefd9e9ff..5aa23a301c1 100644 --- a/src/lib/functions/server.ts +++ b/src/lib/functions/server.ts @@ -279,9 +279,8 @@ export const startFunctionsServer = async (options) => { siteUrl, timeouts, } = options - // @ts-expect-error TS(2345) FIXME: Argument of type '{ base: any; }' is not assignabl... Remove this comment to see the full error message const internalFunctionsDir = await getInternalFunctionsDir({ base: site.root }) - const functionsDirectories = [] + const functionsDirectories: string[] = [] let manifest // If the `loadDistFunctions` parameter is sent, the functions server will diff --git a/src/utils/deploy/deploy-site.ts b/src/utils/deploy/deploy-site.ts index c6010c8b655..32b0f5965c0 100644 --- a/src/utils/deploy/deploy-site.ts +++ b/src/utils/deploy/deploy-site.ts @@ -62,9 +62,18 @@ export const deploySite = async ( tmpDir = temporaryDirectory(), // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message workingDir, + }: { + concurrentHash?: number + concurrentUpload?: number + deployTimeout?: number + draft?: boolean + maxRetry?: number + statusCb?: (status: { type: string; msg: string; phase: string }) => void + syncFileLimit?: number + tmpDir?: string + fnDir?: string[] } = {}, ) => { - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'hashing', msg: `Hashing files...`, @@ -115,7 +124,6 @@ export const deploySite = async ( edgeFunctionsCount > 0 && 'edge functions', ]) - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'hashing', msg: `Finished hashing ${stats}`, @@ -141,7 +149,6 @@ instead of manual deployment. For more information, visit https://ntl.fyi/cli-native-modules.`) } - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'create-deploy', msg: 'CDN diffing files...', @@ -168,7 +175,6 @@ For more information, visit https://ntl.fyi/cli-native-modules.`) const { required: requiredFiles, required_functions: requiredFns } = deploy - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'create-deploy', msg: `CDN requesting ${requiredFiles.length} files${ @@ -183,7 +189,6 @@ For more information, visit https://ntl.fyi/cli-native-modules.`) await uploadFiles(api, deployId, uploadList, { concurrentUpload, statusCb, maxRetry }) - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'wait-for-deploy', msg: 'Waiting for deploy to go live...', @@ -191,7 +196,6 @@ For more information, visit https://ntl.fyi/cli-native-modules.`) }) deploy = await waitForDeploy(api, deployId, siteId, deployTimeout) - // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1. statusCb({ type: 'wait-for-deploy', msg: draft ? 'Draft deploy is live!' : 'Deploy is live!', diff --git a/src/utils/detect-server-settings.ts b/src/utils/detect-server-settings.ts index 18bc5a1904e..942174ff167 100644 --- a/src/utils/detect-server-settings.ts +++ b/src/utils/detect-server-settings.ts @@ -8,7 +8,6 @@ import getPort from 'get-port' import { detectFrameworkSettings } from './build-info.js' import { NETLIFYDEVWARN, chalk, log } from './command-helpers.js' import { acquirePort } from './dev.js' -import { getInternalFunctionsDir } from './functions/functions.js' import { getPluginsToAutoInstall } from './init/utils.js' /** @param {string} str */ @@ -342,9 +341,6 @@ const detectServerSettings = async (devConfig, flags, command) => { }) // @ts-expect-error TS(2339) FIXME: Property 'functions' does not exist on type '{}'. const functionsDir = devConfig.functions || settings.functions - // @ts-expect-error TS(2345) FIXME: Argument of type '{ base: any; }' is not assignabl... Remove this comment to see the full error message - const internalFunctionsDir = await getInternalFunctionsDir({ base: command.workingDir }) - const shouldStartFunctionsServer = Boolean(functionsDir || internalFunctionsDir) return { ...settings, @@ -352,7 +348,7 @@ const detectServerSettings = async (devConfig, flags, command) => { jwtSecret: devConfig.jwtSecret || 'secret', jwtRolePath: devConfig.jwtRolePath || 'app_metadata.authorization.roles', functions: functionsDir, - ...(shouldStartFunctionsServer && { functionsPort: await getPort({ port: devConfig.functionsPort || 0 }) }), + functionsPort: await getPort({ port: devConfig.functionsPort || 0 }), ...(devConfig.https && { https: await readHttpsSettings(devConfig.https) }), } } diff --git a/src/utils/functions/functions.ts b/src/utils/functions/functions.ts index d963cbda1d8..23ce9fc4836 100644 --- a/src/utils/functions/functions.ts +++ b/src/utils/functions/functions.ts @@ -44,14 +44,16 @@ export const getFunctionsServePath = ({ base, packagePath = '' }) => { /** * Retrieves the internal functions directory and creates it if ensureExists is provided - * @param {object} config - * @param {string} config.base - * @param {boolean=} config.ensureExists - * @param {string} config.packagePath - * @returns */ -// @ts-expect-error TS(7031) FIXME: Binding element 'base' implicitly has an 'any' typ... Remove this comment to see the full error message -export const getInternalFunctionsDir = async ({ base, ensureExists, packagePath = '' }) => { +export const getInternalFunctionsDir = async ({ + base, + ensureExists, + packagePath = '', +}: { + base: string + ensureExists?: boolean + packagePath?: string +}) => { const path = resolve(base, packagePath, getPathInProject([INTERNAL_FUNCTIONS_FOLDER])) if (ensureExists) {