From c6aac34df81f2bea43b465cb58e563015df4de70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 19 Mar 2026 15:53:24 +0100 Subject: [PATCH] fix(ocpp): keep StopTransactionRequest as 1.6 wire type, narrow reason via indexed access MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Revert the Omit-based widening of StopTransactionRequest — it's a 1.6 wire protocol message and should not accept OCPP 2.0 reason values. Use StopTransactionRequest['reason'] indexed access type for narrowing in ChargingStation, avoiding any version-specific OCPP16* import. --- src/charging-station/ChargingStation.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 2d63905c..0021490d 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -9,8 +9,6 @@ import { URL } from 'node:url' import { parentPort } from 'node:worker_threads' import { type RawData, WebSocket } from 'ws' -import type { OCPP16StopTransactionReason } from '../types/index.js' - import { BaseError, OCPPError } from '../exception/index.js' import { PerformanceStatistics } from '../performance/index.js' import { @@ -1225,7 +1223,7 @@ export class ChargingStation extends EventEmitter { >(this, RequestCommand.STOP_TRANSACTION, { meterStop: this.getEnergyActiveImportRegisterByTransactionId(rawTransactionId, true), transactionId, - ...(reason != null && { reason: reason as OCPP16StopTransactionReason }), + ...(reason != null && { reason: reason as StopTransactionRequest['reason'] }), }) } -- 2.53.0