Skip to content

Commit 9c1a0dc

Browse files
authored
refactor: Restrict releaseTimestamp type (#22971)
1 parent 11c05fc commit 9c1a0dc

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

lib/modules/datasource/jenkins-plugins/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ export class JenkinsPluginsDatasource extends Datasource {
7070

7171
const versions: Record<string, Release[]> = {};
7272
for (const name of Object.keys(plugins ?? [])) {
73-
versions[name] = Object.keys(plugins[name]).map((version) => ({
74-
version,
75-
downloadUrl: plugins[name][version]?.url,
76-
releaseTimestamp: plugins[name][version]?.buildDate
77-
? // TODO: types (#7154)
78-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
79-
new Date(`${plugins[name][version].buildDate} UTC`)
80-
: null,
81-
}));
73+
versions[name] = Object.keys(plugins[name]).map((version) => {
74+
const downloadUrl = plugins[name][version]?.url;
75+
const buildDate = plugins[name][version]?.buildDate;
76+
const releaseTimestamp = buildDate
77+
? new Date(`${buildDate} UTC`).toISOString()
78+
: null;
79+
return {
80+
version,
81+
downloadUrl,
82+
releaseTimestamp,
83+
};
84+
});
8285
}
8386
return versions;
8487
}

lib/modules/datasource/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface Release {
4646
gitRef?: string;
4747
isDeprecated?: boolean;
4848
isStable?: boolean;
49-
releaseTimestamp?: any;
49+
releaseTimestamp?: string | null;
5050
version: string;
5151
newDigest?: string | undefined;
5252
constraints?: Record<string, string[]>;

0 commit comments

Comments
 (0)