Properly define common OCPP types using enum
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 2 Mar 2021 21:03:21 +0000 (22:03 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 2 Mar 2021 21:03:21 +0000 (22:03 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/types/ocpp/ChargePointErrorCode.ts
src/types/ocpp/ChargePointStatus.ts
src/types/ocpp/Configuration.ts
src/types/ocpp/MeterValues.ts
src/types/ocpp/Requests.ts
src/types/ocpp/Responses.ts
src/types/ocpp/Transaction.ts

index 52442e54e2880bb3ed1dcd4a522c3383f3d7d1e8..30d91ad84d03135bd177a23c25bd3ef9208d2a8f 100644 (file)
@@ -1,3 +1,7 @@
 import { OCPP16ChargePointErrorCode } from './1.6/ChargePointErrorCode';
 
-export type ChargePointErrorCode = OCPP16ChargePointErrorCode;
+export type ChargePointErrorCode = typeof ChargePointErrorCode;
+
+export const ChargePointErrorCode = {
+  ...OCPP16ChargePointErrorCode
+};
index daa9779bed14bc3819e855e50e03157ec52565a2..595edc415a1e21aa68690b9f6be6e4f7d9ee97d5 100644 (file)
@@ -1,6 +1,6 @@
 import { OCPP16ChargePointStatus } from './1.6/ChargePointStatus';
 
-export type ChargePointStatus = OCPP16ChargePointStatus;
+export type ChargePointStatus = typeof ChargePointStatus;
 
 export const ChargePointStatus = {
   ...OCPP16ChargePointStatus
index f486532574c4a9355b6b95f137f18c3e825ce564..54fba5a2edbe6c030a4c626c1adee61bfed3d6d3 100644 (file)
@@ -1,6 +1,6 @@
 import { OCPP16StandardParametersKey } from './1.6/Configuration';
 
-export type StandardParametersKey = OCPP16StandardParametersKey;
+export type StandardParametersKey = typeof StandardParametersKey;
 
 export const StandardParametersKey = {
   ...OCPP16StandardParametersKey
index b052ce694beaf94617bce80dd1266052eb3fcb64..c8c283860f7776108483a7d4b912d7b5daff0891 100644 (file)
@@ -1,6 +1,6 @@
 import { OCPP16MeterValueMeasurand, OCPP16SampledValue } from './1.6/MeterValues';
 
-export type MeterValueMeasurand = OCPP16MeterValueMeasurand;
+export type MeterValueMeasurand = typeof MeterValueMeasurand;
 
 export const MeterValueMeasurand = {
   ...OCPP16MeterValueMeasurand
index 86838d221c636b6f98f59860f1c42b0ae552e2d7..8292156d500b3295d45a404e4ec2746c44d4b313 100644 (file)
@@ -9,19 +9,23 @@ export default interface Requests {
 
 export type BootNotificationRequest = OCPP16BootNotificationRequest;
 
-export type AvailabilityType = OCPP16AvailabilityType;
+export type AvailabilityType = typeof AvailabilityType;
 
 export const AvailabilityType = {
   ...OCPP16AvailabilityType
 };
 
-export type RequestCommand = OCPP16RequestCommand;
+export type RequestCommand = typeof RequestCommand;
 
 export const RequestCommand = {
   ...OCPP16RequestCommand
 };
 
-export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
+export type IncomingRequestCommand = typeof IncomingRequestCommand;
+
+export const IncomingRequestCommand = {
+  ...OCPP16IncomingRequestCommand
+};
 
 export type Request = [(payload?: Record<string, unknown>, requestPayload?: Record<string, unknown>) => void, (error?: OCPPError) => void, Record<string, unknown>];
 
index d134f545de2e9118152f348fe634ae14c79af428..7e0a3c32dd621a9e4fb4307b9d127dd982805e7c 100644 (file)
@@ -2,7 +2,7 @@ import { OCPP16BootNotificationResponse, OCPP16RegistrationStatus } from './1.6/
 
 export type BootNotificationResponse = OCPP16BootNotificationResponse;
 
-export type RegistrationStatus = OCPP16RegistrationStatus;
+export type RegistrationStatus = typeof RegistrationStatus;
 
 export const RegistrationStatus = {
   ...OCPP16RegistrationStatus
index 83764a21f73e9eb4b8187ccc9fd46eaf50f3e4b1..cca05a395c0e54f475782661092fac9008d984f3 100644 (file)
@@ -1,6 +1,6 @@
 import { OCPP16AuthorizationStatus, OCPP16AuthorizeResponse, OCPP16StartTransactionResponse, OCPP16StopTransactionReason, OCPP16StopTransactionResponse } from './1.6/Transaction';
 
-export type AuthorizationStatus = OCPP16AuthorizationStatus;
+export type AuthorizationStatus = typeof AuthorizationStatus;
 
 export const AuthorizationStatus = {
   ...OCPP16AuthorizationStatus,
@@ -8,7 +8,7 @@ export const AuthorizationStatus = {
 
 export type AuthorizeResponse = OCPP16AuthorizeResponse;
 
-export type StopTransactionReason = OCPP16StopTransactionReason;
+export type StopTransactionReason = typeof StopTransactionReason;
 
 export const StopTransactionReason = {
   ...OCPP16StopTransactionReason,