diff --git a/lib/config/migration.spec.ts b/lib/config/migration.spec.ts index 4376df82f80346061e2731d4d3cb5afbd491e8a1..e7b8dccef2cc0f3e3c43125bae7d49ea2ee206a8 100644 --- a/lib/config/migration.spec.ts +++ b/lib/config/migration.spec.ts @@ -304,8 +304,10 @@ describe('config/migration', () => { expect(isMigrated).toBeTrue(); expect(migratedConfig).toMatchSnapshot(); expect(migratedConfig.lockFileMaintenance?.packageRules).toHaveLength(1); + // TODO: fix types #7154 expect( - migratedConfig.lockFileMaintenance?.packageRules[0].respectLatest + (migratedConfig.lockFileMaintenance as RenovateConfig) + ?.packageRules?.[0].respectLatest ).toBeFalse(); }); diff --git a/lib/config/migration.ts b/lib/config/migration.ts index 3567714432be516d50cc926409a672a0cbd50da7..ac75c9d1db6290829dadc76def1f8103231dffe9 100644 --- a/lib/config/migration.ts +++ b/lib/config/migration.ts @@ -221,7 +221,8 @@ export function migrateConfig(config: RenovateConfig): MigratedConfig { for (const [oldKey, ruleVal] of Object.entries(packageRule)) { const newKey = renameMap[oldKey as keyof typeof renameMap]; if (newKey) { - packageRule[newKey] = ruleVal; + // TODO: fix types #7154 + packageRule[newKey] = ruleVal as never; delete packageRule[oldKey]; } } diff --git a/lib/config/migrations/custom/compatibility-migration.ts b/lib/config/migrations/custom/compatibility-migration.ts index a22ddb1485a81dd0f871f1afd7e4acb7b7bd3bf1..69c44322bc1d748ddc54c9f044fa9dd14fe2291a 100644 --- a/lib/config/migrations/custom/compatibility-migration.ts +++ b/lib/config/migrations/custom/compatibility-migration.ts @@ -7,7 +7,7 @@ export class CompatibilityMigration extends AbstractMigration { override run(value: unknown): void { if (is.object(value)) { - this.setSafely('constraints', value); + this.setSafely('constraints', value as Record<string, string>); } } } diff --git a/lib/config/types.ts b/lib/config/types.ts index e49d86f2d5be6523b96c009dc12ea02b97dd2765..962e19bbef215f8da25a8bff8a718c7cc935270d 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -38,6 +38,7 @@ export interface RenovateSharedConfig { enabledManagers?: string[]; extends?: string[]; fileMatch?: string[]; + force?: RenovateConfig; group?: GroupConfig; groupName?: string; groupSlug?: string; @@ -58,6 +59,7 @@ export interface RenovateSharedConfig { productLinks?: Record<string, string>; prPriority?: number; rebaseLabel?: string; + respectLatest?: boolean; stopUpdatingLabel?: string; rebaseWhen?: string; recreateClosed?: boolean; @@ -140,16 +142,18 @@ export interface LegacyAdminConfig { requireConfig?: RequiredConfig; } + export type ExecutionMode = 'branch' | 'update'; -export type PostUpgradeTasks = { +export interface PostUpgradeTasks { commands?: string[]; fileFilters?: string[]; executionMode: ExecutionMode; -}; +} -type UpdateConfig<T extends RenovateSharedConfig = RenovateSharedConfig> = - Partial<Record<UpdateType, T | null>>; +export type UpdateConfig< + T extends RenovateSharedConfig = RenovateSharedConfig +> = Partial<Record<UpdateType, T | null>>; export type RenovateRepository = | string @@ -228,6 +232,8 @@ export interface RenovateConfig fetchReleaseNotes?: boolean; secrets?: Record<string, string>; + + constraints?: Record<string, string>; } export interface AllConfig extends RenovateConfig, GlobalOnlyConfig {} @@ -269,7 +275,8 @@ export type MergeStrategy = export interface PackageRule extends RenovateSharedConfig, UpdateConfig, - Record<string, any> { + Record<string, unknown> { + description?: string | string[]; matchFiles?: string[]; matchPaths?: string[]; matchLanguages?: string[]; @@ -287,6 +294,7 @@ export interface PackageRule matchSourceUrlPrefixes?: string[]; matchSourceUrls?: string[]; matchUpdateTypes?: UpdateType[]; + registryUrls?: string[]; } export interface ValidationMessage { diff --git a/lib/config/validation.spec.ts b/lib/config/validation.spec.ts index 1d7f3246482502fe2816a4a9b27081dec46117e6..e61740dc75bb3fd66f895ddc8a4db27a1ebeaa1f 100644 --- a/lib/config/validation.spec.ts +++ b/lib/config/validation.spec.ts @@ -488,7 +488,7 @@ describe('config/validation', () => { constraints: { packageRules: [{}] }, }; const { warnings, errors } = await configValidation.validateConfig( - config, + config as never, // TODO: #15963 true ); expect(warnings).toHaveLength(0); diff --git a/lib/modules/datasource/npm/npmrc.ts b/lib/modules/datasource/npm/npmrc.ts index a643ea56df2fe3818fa5fe5e430fd733f9035bf9..fccb2d7fd4d6a891e9d51c0a6b213fdc8b7044dd 100644 --- a/lib/modules/datasource/npm/npmrc.ts +++ b/lib/modules/datasource/npm/npmrc.ts @@ -173,7 +173,9 @@ export function resolveRegistryUrl(packageName: string): string { !matchPackagePrefixes || packageName.startsWith(matchPackagePrefixes[0]) ) { - registryUrl = registryUrls[0]; + // TODO: fix types #7154 + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + registryUrl = registryUrls![0]; } } return registryUrl; diff --git a/lib/workers/types.ts b/lib/workers/types.ts index 8b1f69c89036c82177a040018cdc52659bd3c647..9abae80d8831f8c81263913f1b18e13041aff3d8 100644 --- a/lib/workers/types.ts +++ b/lib/workers/types.ts @@ -40,7 +40,6 @@ export interface BranchUpgradeConfig excludeCommitPaths?: string[]; githubName?: string; group?: GroupConfig; - constraints?: Record<string, string>; groupName?: string; groupSlug?: string; language?: string; diff --git a/tools/docs/presets.ts b/tools/docs/presets.ts index 9bbfa8c8760e6e318c491264fcac7df181ba10bf..307cb31698c25af1f4acdd58b116b8fb9c0a693b 100644 --- a/tools/docs/presets.ts +++ b/tools/docs/presets.ts @@ -38,7 +38,7 @@ export async function generatePresets(dist: string): Promise<void> { delete value.description; if (!presetDescription) { if (value.packageRules?.[0].description) { - presetDescription = value.packageRules[0].description; + presetDescription = value.packageRules[0].description as string; delete value.packageRules[0].description; } }