deepsource-autofix-76c6eb20
Dan Gowans 2023-01-24 15:43:03 -05:00
parent c88e4912f8
commit 5b4a316aac
9 changed files with 14 additions and 11 deletions

View File

@ -25,7 +25,7 @@ function onError(error) {
} }
function onListening(server) { function onListening(server) {
const addr = server.address(); const addr = server.address();
if (addr) { if (addr !== null) {
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString(); const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString();
debug('Listening on ' + bind); debug('Listening on ' + bind);
} }

View File

@ -50,7 +50,7 @@ function onError(error: ServerError): void {
function onListening(server: http.Server): void { function onListening(server: http.Server): void {
const addr = server.address() const addr = server.address()
if (addr) { if (addr !== null) {
const bind = const bind =
typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString() typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString()
debug('Listening on ' + bind) debug('Listening on ' + bind)

View File

@ -8,7 +8,7 @@ export async function handler(_request, response) {
const occupancyTypePrintTitles = {}; const occupancyTypePrintTitles = {};
for (const printEJS of occupancyTypePrints) { for (const printEJS of occupancyTypePrints) {
const printConfig = printFunctions.getPrintConfig(printEJS); const printConfig = printFunctions.getPrintConfig(printEJS);
if (printConfig) { if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title; occupancyTypePrintTitles[printEJS] = printConfig.title;
} }
} }

View File

@ -24,7 +24,7 @@ export async function handler(
for (const printEJS of occupancyTypePrints) { for (const printEJS of occupancyTypePrints) {
const printConfig = printFunctions.getPrintConfig(printEJS) const printConfig = printFunctions.getPrintConfig(printEJS)
if (printConfig) { if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title occupancyTypePrintTitles[printEJS] = printConfig.title
} }
} }

View File

@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js'
import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js' import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js'
import * as cacheFunctions from '../../helpers/functions.cache.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( export async function handler(
request: Request, request: Request,

View File

@ -1,3 +1,3 @@
import { Request, Response } from 'express'; import type { Request, Response } from 'express';
export declare function handler(request: Request, response: Response): Promise<void>; export declare function handler(request: Request, response: Response): Promise<void>;
export default handler; export default handler;

View File

@ -1,4 +1,5 @@
import { Request, Response } from 'express' import type { Request, Response } from 'express'
import { getLots } from '../../helpers/lotOccupancyDB/getLots.js' import { getLots } from '../../helpers/lotOccupancyDB/getLots.js'
export async function handler(request: Request, response: Response): Promise<void> { export async function handler(request: Request, response: Response): Promise<void> {

View File

@ -51,7 +51,7 @@ export async function getReportData(printConfig, requestQuery) {
if (printConfig.params.includes('lotOccupancyId') && if (printConfig.params.includes('lotOccupancyId') &&
typeof requestQuery.lotOccupancyId === 'string') { typeof requestQuery.lotOccupancyId === 'string') {
const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId); const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId);
if (lotOccupancy?.lotId) { if ((lotOccupancy?.lotId ?? -1) !== -1) {
reportData.lot = getLot(lotOccupancy.lotId); reportData.lot = getLot(lotOccupancy.lotId);
} }
reportData.lotOccupancy = lotOccupancy; reportData.lotOccupancy = lotOccupancy;

View File

@ -18,7 +18,9 @@ const screenPrintConfigs: Record<string, PrintConfig> = {
} }
} }
export function getScreenPrintConfig(printName: string): PrintConfig | undefined { export function getScreenPrintConfig(
printName: string
): PrintConfig | undefined {
return screenPrintConfigs[printName] return screenPrintConfigs[printName]
} }
@ -78,8 +80,8 @@ export async function getReportData(
) { ) {
const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId) const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId)
if (lotOccupancy?.lotId) { if ((lotOccupancy?.lotId ?? -1) !== -1) {
reportData.lot = getLot(lotOccupancy.lotId) reportData.lot = getLot(lotOccupancy!.lotId!)
} }
reportData.lotOccupancy = lotOccupancy reportData.lotOccupancy = lotOccupancy