diff --git a/src/utils/package.test.ts b/src/utils/package.test.ts index 52de2f7..3674156 100644 --- a/src/utils/package.test.ts +++ b/src/utils/package.test.ts @@ -13,9 +13,9 @@ describe('formatLicense', (): void => { }); test('should check license field for other value', (): void => { - expect(formatLicense(null)).toBeNull(); - expect(formatLicense({})).toBeNull(); - expect(formatLicense([])).toBeNull(); + expect(formatLicense(null)).toBeUndefined(); + expect(formatLicense({})).toBeUndefined(); + expect(formatLicense([])).toBeUndefined(); }); }); diff --git a/src/utils/package.ts b/src/utils/package.ts index 485885a..eacd5ab 100644 --- a/src/utils/package.ts +++ b/src/utils/package.ts @@ -12,7 +12,7 @@ export const TIMEFORMAT = 'DD.MM.YYYY, HH:mm:ss'; */ // License should use type License defined above, but conflicts with the unit test that provide array or empty object /* eslint-disable @typescript-eslint/no-explicit-any */ -export function formatLicense(license: any): string | null { +export function formatLicense(license: any): string | undefined { if (isString(license)) { return license; } @@ -21,7 +21,7 @@ export function formatLicense(license: any): string | null { return license.type; } - return null; + return; } export interface Repository { diff --git a/types/packageMeta.ts b/types/packageMeta.ts index bc86360..171095d 100644 --- a/types/packageMeta.ts +++ b/types/packageMeta.ts @@ -5,7 +5,7 @@ export interface PackageMetaInterface { fileCount: number; unpackedSize: number; }; - license?: Partial | string | null; + license?: Partial | string; }; _uplinks: {}; }