Bump to TypeScript 5.5 and enable noImplicitAny

This commit upgrades TypeScript from 5.4 to 5.5 and enables the
`noImplicitAny` option for stricter type checking. It refactors code to
comply with `noImplicitAny` and adapts to new TypeScript features and
limitations.

Key changes:

- Migrate from TypeScript 5.4 to 5.5
- Enable `noImplicitAny` for stricter type checking
- Refactor code to comply with new TypeScript features and limitations

Other supporting changes:

- Refactor progress bar handling for type safety
- Drop 'I' prefix from interfaces to align with new code convention
- Update TypeScript target from `ES2017` and `ES2018`.
  This allows named capturing groups. Otherwise, new TypeScript compiler
  does not compile the project and shows the following error:
  ```
  ...
  TimestampedFilenameGenerator.spec.ts:105:23 - error TS1503: Named capturing groups are only available when targeting 'ES2018' or later
  const pattern = /^(?<timestamp>\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})-(?<scriptName>[^.]+?)(?:\.(?<extension>[^.]+))?$/;// timestamp-scriptName.extension
  ...
  ```
- Refactor usage of `electron-progressbar` for type safety and
  less complexity.
This commit is contained in:
undergroundwires
2024-09-26 16:07:37 +02:00
parent a05a600071
commit e17744faf0
77 changed files with 656 additions and 332 deletions

View File

@@ -38,7 +38,7 @@ export class ExpressionStub implements IExpression {
this.callHistory.push(context);
if (this.result === undefined /* not empty string */) {
const { args } = context;
return `[expression-stub] args: ${args ? Object.keys(args).map((key) => `${key}: ${args[key]}`).join('", "') : 'none'}`;
return `[expression-stub] args: ${args ? Object.entries(args).map((key, value) => `${key}: ${value}`).join('", "') : 'none'}`;
}
return this.result;
}

View File

@@ -1,6 +1,6 @@
import type { ISanityCheckOptions } from '@/infrastructure/RuntimeSanity/Common/ISanityCheckOptions';
import type { SanityCheckOptions } from '@/infrastructure/RuntimeSanity/Common/SanityCheckOptions';
export class SanityCheckOptionsStub implements ISanityCheckOptions {
export class SanityCheckOptionsStub implements SanityCheckOptions {
public validateWindowVariables = false;
public validateEnvironmentVariables = false;

View File

@@ -1,8 +1,8 @@
import type { ISanityCheckOptions } from '@/infrastructure/RuntimeSanity/Common/ISanityCheckOptions';
import type { ISanityValidator } from '@/infrastructure/RuntimeSanity/Common/ISanityValidator';
import type { SanityCheckOptions } from '@/infrastructure/RuntimeSanity/Common/SanityCheckOptions';
import type { SanityValidator } from '@/infrastructure/RuntimeSanity/Common/SanityValidator';
export class SanityValidatorStub implements ISanityValidator {
public shouldValidateArgs = new Array<ISanityCheckOptions>();
export class SanityValidatorStub implements SanityValidator {
public shouldValidateArgs = new Array<SanityCheckOptions>();
public name = 'sanity-validator-stub';
@@ -10,7 +10,7 @@ export class SanityValidatorStub implements ISanityValidator {
private shouldValidateResult = true;
public shouldValidate(options: ISanityCheckOptions): boolean {
public shouldValidate(options: SanityCheckOptions): boolean {
this.shouldValidateArgs.push(options);
return this.shouldValidateResult;
}

View File

@@ -11,7 +11,7 @@ export class VueDependencyInjectionApiStub implements VueDependencyInjectionApi
public inject<T>(key: InjectionKey<T>): T {
const providedValue = this.injections.get(key);
if (providedValue === undefined) {
throw new Error(`[VueDependencyInjectionApiStub] No value provided for key: ${String(key)}`);
throw new Error(`[${VueDependencyInjectionApiStub.name}] No value provided for key: ${String(key)}`);
}
return providedValue as T;
}