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 BugReport from '@material-ui/icons/BugReport';
import Grid from '@material-ui/core/Grid'; import Grid from '@material-ui/core/Grid';
import HomeIcon from '@material-ui/icons/Home'; 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 Tag from '../Tag';
import fileSizeSI from '../../utils/file-size'; import fileSizeSI from '../../utils/file-size';
import { formatDate, formatDateDistance } from '../../utils/package'; 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'; import API from './api';

View File

@ -5,6 +5,8 @@ import isString from 'lodash/isString';
import format from 'date-fns/format'; import format from 'date-fns/format';
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
import { Time } from '../../types/packageMeta';
export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss'; export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss';
/** /**
@ -82,8 +84,8 @@ export function getLastUpdatedPackageTime(uplinks: UpLinks = {}): string {
* @param {Object} time * @param {Object} time
* @returns {Array} last 3 releases * @returns {Array} last 3 releases
*/ */
export function getRecentReleases(time = {}): unknown { export function getRecentReleases(time: Time = {}): Time[] {
const recent = Object.keys(time).map((version): unknown => ({ const recent = Object.keys(time).map(version => ({
version, version,
time: formatDate(time[version]), time: formatDate(time[version]),
})); }));

View File

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