forked from sombochea/verdaccio-ui
refactor: Added typings for getRecentReleases (#190)
This commit is contained in:
parent
6f87be68be
commit
1abc15603e
@ -2,8 +2,8 @@ import React from 'react';
|
||||
import BugReport from '@material-ui/icons/BugReport';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import HomeIcon from '@material-ui/icons/Home';
|
||||
import { PackageMetaInterface, Author as PackageAuthor } from 'types/packageMeta';
|
||||
|
||||
import { PackageMetaInterface, Author as PackageAuthor } from '../../../types/packageMeta';
|
||||
import Tag from '../Tag';
|
||||
import fileSizeSI from '../../utils/file-size';
|
||||
import { formatDate, formatDateDistance } from '../../utils/package';
|
||||
|
@ -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]),
|
||||
}));
|
||||
|
@ -12,7 +12,6 @@
|
||||
"resolveJsonModule": true,
|
||||
"checkJs": false,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "."
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
|
Loading…
Reference in New Issue
Block a user