forked from sombochea/verdaccio-ui
refactor: Added typings for getRecentReleases (#190)
This commit is contained in:
committed by
Priscila Oliveira
parent
6f87be68be
commit
1abc15603e
@@ -1,4 +1,4 @@
|
||||
import { PackageMetaInterface } from 'types/packageMeta';
|
||||
import { PackageMetaInterface } from '../../types/packageMeta';
|
||||
|
||||
import API from './api';
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import isString from 'lodash/isString';
|
||||
import format from 'date-fns/format';
|
||||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
|
||||
|
||||
import { Time } from '../../types/packageMeta';
|
||||
|
||||
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
|
||||
|
||||
/**
|
||||
@@ -82,8 +84,8 @@ export function getLastUpdatedPackageTime(uplinks: UpLinks = {}): string {
|
||||
* @param {Object} time
|
||||
* @returns {Array} last 3 releases
|
||||
*/
|
||||
export function getRecentReleases(time = {}): unknown {
|
||||
const recent = Object.keys(time).map((version): unknown => ({
|
||||
export function getRecentReleases(time: Time = {}): Time[] {
|
||||
const recent = Object.keys(time).map(version => ({
|
||||
version,
|
||||
time: formatDate(time[version]),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user