1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-24 06:54:27 +07:00

refactor: Added typings for getRecentReleases (#190)

This commit is contained in:
Thomas Klein 2019-10-15 12:08:16 +02:00 committed by Priscila Oliveira
parent 6f87be68be
commit 1abc15603e
4 changed files with 6 additions and 5 deletions

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { PackageMetaInterface } from 'types/packageMeta';
import { PackageMetaInterface } from '../../types/packageMeta';
import API from './api';

View File

@ -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]),
}));

View File

@ -12,7 +12,6 @@
"resolveJsonModule": true,
"checkJs": false,
"esModuleInterop": true,
"baseUrl": "."
},
"include": [
"src",