Skip to content

Commit

Permalink
feat(interfaces): LicenseObject
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Dec 1, 2022
1 parent 8166f6f commit ec81ecd
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/interfaces/__tests__/license-object.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @file Unit Tests - LicenseObject
* @module pkg-types/interfaces/tests/LicenseObject
*/

import type TestSubject from '../license-object'

describe('unit:interfaces/LicenseObject', () => {
const url: string = 'https://www.opensource.org/licenses/mit-license.php'

it('should allow empty object', () => {
assertType<TestSubject>({})
})

it('should allow object that only has property "url"', () => {
assertType<TestSubject>({ url })
})

it('should allow object with all properties', () => {
assertType<Required<TestSubject>>({ type: 'MIT', url })
})
})
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export type { default as BugsObject } from './bugs-object'
export type { default as DependencyMeta } from './dependency-meta'
export type { default as FundingObject } from './funding-object'
export type { default as InstallConfig } from './install-config'
export type { default as LicenseObject } from './license-object'
export type { default as PeerDependencyMeta } from './peer-dependency-meta'
export type { default as WorkspacesConfig } from './workspaces-config'
23 changes: 23 additions & 0 deletions src/interfaces/license-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @file Interfaces - LicenseObject
* @module pkg-types/interfaces/LicenseObject
*/

/**
* Object representing a package license.
*
* @see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#license
*/
interface LicenseObject {
/**
* License type.
*/
type?: string

/**
* License URL.
*/
url?: string
}

export type { LicenseObject as default }

0 comments on commit ec81ecd

Please sign in to comment.