From c8aafe0d6d0ccc1c9bbce5db003e3bb27be9044f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 18 Mar 2023 01:01:29 +0100 Subject: [PATCH] build(simulator): switch to TS 5.x.x MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 35 +++++++++++++++++----- package.json | 2 +- src/charging-station/ChargingStation.ts | 2 +- src/performance/storage/MikroOrmStorage.ts | 8 ++++- src/types/index.ts | 2 +- src/types/internal.ts | 20 ++++++------- tsconfig.json | 2 +- 7 files changed, 48 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2484fc5a..032dba77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,7 @@ "rollup-plugin-delete": "^2.0.0", "semver": "^7.3.8", "ts-node": "^10.9.1", - "typescript": "^4.9.5" + "typescript": "^5.0.2" }, "engines": { "node": ">=16.0.0", @@ -663,6 +663,19 @@ "node": ">=8" } }, + "node_modules/@commitlint/load/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/@commitlint/message": { "version": "17.4.2", "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-17.4.2.tgz", @@ -16195,16 +16208,16 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/uglify-js": { @@ -17679,6 +17692,12 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true } } }, @@ -29695,9 +29714,9 @@ } }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 3d7a11d9..2092bf30 100644 --- a/package.json +++ b/package.json @@ -146,6 +146,6 @@ "rollup-plugin-delete": "^2.0.0", "semver": "^7.3.8", "ts-node": "^10.9.1", - "typescript": "^4.9.5" + "typescript": "^5.0.2" } } diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index c4388061..9125c377 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -47,7 +47,7 @@ import { type ChargingStationOcppConfiguration, type ChargingStationTemplate, ConnectorPhaseRotation, - ConnectorStatus, + type ConnectorStatus, ConnectorStatusEnum, CurrentType, type ErrorCallback, diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index 47823c80..72fc82e8 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -1,6 +1,12 @@ // Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import { Configuration, Connection, IDatabaseDriver, MikroORM, Options } from '@mikro-orm/core'; +import { + Configuration, + Connection, + type IDatabaseDriver, + MikroORM, + type Options, +} from '@mikro-orm/core'; import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; import { diff --git a/src/types/index.ts b/src/types/index.ts index 406cbd00..a7c7d24e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -45,7 +45,7 @@ export { type ConfigurationKeyType, ConfigurationStatus, ConnectorPhaseRotation, - ConnectorStatus, + type ConnectorStatus, ConnectorStatusEnum, CurrentType, DBName, diff --git a/src/types/internal.ts b/src/types/internal.ts index c7a141a4..3d9fa5cb 100644 --- a/src/types/internal.ts +++ b/src/types/internal.ts @@ -15,11 +15,11 @@ export * from './ocpp/ChargePointErrorCode'; export * from './ocpp/ChargingProfile'; export * from './ocpp/Configuration'; export * from './ocpp/ConnectorStatusEnum'; -export * from './ocpp/ErrorType'; +export { ErrorType } from './ocpp/ErrorType'; export * from './ocpp/MessageType'; export * from './ocpp/MeterValues'; -export * from './ocpp/OCPPProtocol'; -export * from './ocpp/OCPPVersion'; +export { OCPPProtocol } from './ocpp/OCPPProtocol'; +export { OCPPVersion } from './ocpp/OCPPVersion'; export * from './ocpp/Requests'; export * from './ocpp/Responses'; export * from './ocpp/Transaction'; @@ -27,18 +27,18 @@ export * from './orm/entities/PerformanceData'; export * from './orm/entities/PerformanceRecord'; export * from './AutomaticTransactionGenerator'; export * from './ChargingStationConfiguration'; -export * from './ChargingStationInfo'; +export type { ChargingStationInfo, ChargingStationInfoConfiguration } from './ChargingStationInfo'; export * from './ChargingStationOcppConfiguration'; export * from './ChargingStationTemplate'; export * from './ChargingStationWorker'; export * from './ConfigurationData'; -export * from './ConnectorStatus'; -export * from './EmptyObject'; -export * from './Error'; -export * from './FileType'; -export * from './JsonType'; +export type { ConnectorStatus } from './ConnectorStatus'; +export type { EmptyObject } from './EmptyObject'; +export type { HandleErrorParams } from './Error'; +export { FileType } from './FileType'; +export type { JsonType, JsonObject } from './JsonType'; export * from './MeasurandPerPhaseSampledValueTemplates'; -export * from './MeasurandValues'; +export type { MeasurandValues } from './MeasurandValues'; export * from './Statistics'; export * from './Storage'; export * from './UIProtocol'; diff --git a/tsconfig.json b/tsconfig.json index 0944a20d..82b4e8ef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,6 +23,7 @@ "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + "verbatimModuleSyntax": true, /* Strict Type-Checking Options */ // "strict": true, /* Enable all strict type-checking options. */ @@ -33,7 +34,6 @@ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "importsNotUsedAsValues": "error", /* Enforce using `import type` instead of `import` for types */ /* Additional Checks */ // "noUnusedLocals": true, /* Report errors on unused locals. */ -- 2.34.1