diff --git a/bin/www.js b/bin/www.js index 7a84e091..122901e6 100644 --- a/bin/www.js +++ b/bin/www.js @@ -25,7 +25,7 @@ function onError(error) { } function onListening(server) { const addr = server.address(); - if (addr) { + if (addr !== null) { const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString(); debug('Listening on ' + bind); } diff --git a/bin/www.ts b/bin/www.ts index ddd72b5d..af6d0372 100644 --- a/bin/www.ts +++ b/bin/www.ts @@ -50,7 +50,7 @@ function onError(error: ServerError): void { function onListening(server: http.Server): void { const addr = server.address() - if (addr) { + if (addr !== null) { const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString() debug('Listening on ' + bind) diff --git a/handlers/admin-get/occupancyTypes.js b/handlers/admin-get/occupancyTypes.js index 10a6d8a2..9ece2e01 100644 --- a/handlers/admin-get/occupancyTypes.js +++ b/handlers/admin-get/occupancyTypes.js @@ -8,7 +8,7 @@ export async function handler(_request, response) { const occupancyTypePrintTitles = {}; for (const printEJS of occupancyTypePrints) { const printConfig = printFunctions.getPrintConfig(printEJS); - if (printConfig) { + if (printConfig !== undefined) { occupancyTypePrintTitles[printEJS] = printConfig.title; } } diff --git a/handlers/admin-get/occupancyTypes.ts b/handlers/admin-get/occupancyTypes.ts index 0362f351..27ad0c30 100644 --- a/handlers/admin-get/occupancyTypes.ts +++ b/handlers/admin-get/occupancyTypes.ts @@ -24,7 +24,7 @@ export async function handler( for (const printEJS of occupancyTypePrints) { const printConfig = printFunctions.getPrintConfig(printEJS) - if (printConfig) { + if (printConfig !== undefined) { occupancyTypePrintTitles[printEJS] = printConfig.title } } diff --git a/handlers/lots-get/new.ts b/handlers/lots-get/new.ts index 3b42063c..fdf11d49 100644 --- a/handlers/lots-get/new.ts +++ b/handlers/lots-get/new.ts @@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js' import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js' import * as cacheFunctions from '../../helpers/functions.cache.js' -import * as recordTypes from '../../types/recordTypes' +import type * as recordTypes from '../../types/recordTypes' export async function handler( request: Request, diff --git a/handlers/lots-post/doSearchLots.d.ts b/handlers/lots-post/doSearchLots.d.ts index 84998c62..7c872b55 100644 --- a/handlers/lots-post/doSearchLots.d.ts +++ b/handlers/lots-post/doSearchLots.d.ts @@ -1,3 +1,3 @@ -import { Request, Response } from 'express'; +import type { Request, Response } from 'express'; export declare function handler(request: Request, response: Response): Promise; export default handler; diff --git a/handlers/lots-post/doSearchLots.ts b/handlers/lots-post/doSearchLots.ts index 613b630e..0bd91afc 100644 --- a/handlers/lots-post/doSearchLots.ts +++ b/handlers/lots-post/doSearchLots.ts @@ -1,4 +1,5 @@ -import { Request, Response } from 'express' +import type { Request, Response } from 'express' + import { getLots } from '../../helpers/lotOccupancyDB/getLots.js' export async function handler(request: Request, response: Response): Promise { diff --git a/helpers/functions.print.js b/helpers/functions.print.js index 08a9a801..80a74a6a 100644 --- a/helpers/functions.print.js +++ b/helpers/functions.print.js @@ -51,7 +51,7 @@ export async function getReportData(printConfig, requestQuery) { if (printConfig.params.includes('lotOccupancyId') && typeof requestQuery.lotOccupancyId === 'string') { const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId); - if (lotOccupancy?.lotId) { + if ((lotOccupancy?.lotId ?? -1) !== -1) { reportData.lot = getLot(lotOccupancy.lotId); } reportData.lotOccupancy = lotOccupancy; diff --git a/helpers/functions.print.ts b/helpers/functions.print.ts index 2960ca90..9cf0b827 100644 --- a/helpers/functions.print.ts +++ b/helpers/functions.print.ts @@ -18,7 +18,9 @@ const screenPrintConfigs: Record = { } } -export function getScreenPrintConfig(printName: string): PrintConfig | undefined { +export function getScreenPrintConfig( + printName: string +): PrintConfig | undefined { return screenPrintConfigs[printName] } @@ -78,8 +80,8 @@ export async function getReportData( ) { const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId) - if (lotOccupancy?.lotId) { - reportData.lot = getLot(lotOccupancy.lotId) + if ((lotOccupancy?.lotId ?? -1) !== -1) { + reportData.lot = getLot(lotOccupancy!.lotId!) } reportData.lotOccupancy = lotOccupancy