mirror of
https://github.com/SomboChea/ui
synced 2026-01-16 08:05:44 +07:00
fix: improved typing (#174)
This commit is contained in:
committed by
Juan Picado @jotadeveloper
parent
68b7171de4
commit
e0642a9d0d
@@ -2,7 +2,7 @@ import { PackageMetaInterface } from 'types/packageMeta';
|
||||
|
||||
import API from './api';
|
||||
|
||||
export async function callReadme(packageName, packageVersion?: string): Promise<string | {}> {
|
||||
export async function callReadme(packageName: string, packageVersion?: string): Promise<string | {}> {
|
||||
return await API.request<string | {}>(`package/readme/${packageName}${packageVersion ? `?v=${packageVersion}` : ''}`, 'GET');
|
||||
}
|
||||
|
||||
|
||||
@@ -49,11 +49,11 @@ export function formatRepository(repository: any): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function formatDate(lastUpdate): string {
|
||||
export function formatDate(lastUpdate: string | number): string {
|
||||
return format(new Date(lastUpdate), TIMEFORMAT);
|
||||
}
|
||||
|
||||
export function formatDateDistance(lastUpdate): string {
|
||||
export function formatDateDistance(lastUpdate: Date | string | number): string {
|
||||
return distanceInWordsToNow(new Date(lastUpdate));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export function isURL(url: string): boolean {
|
||||
});
|
||||
}
|
||||
|
||||
export function isEmail(email): boolean {
|
||||
export function isEmail(email: string): boolean {
|
||||
return isEmailValidator(email || '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user