Skip to content

Commit

Permalink
feat(interfaces): PeerDependencyMeta
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 39df145 commit 78a4cbd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/interfaces/__tests__/peer-dependency-meta.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @file Unit Tests - PeerDependencyMeta
* @module pkg-types/interfaces/tests/PeerDependencyMeta
*/

import type TestSubject from '../peer-dependency-meta'

describe('unit:interfaces/PeerDependencyMeta', () => {
it('should allow empty object', () => {
assertType<TestSubject>({})
})

it('should allow object with peer dependency metadat', () => {
assertType<TestSubject>({ optional: false })
})
})
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*/

export type { default as DependencyMeta } from './dependency-meta'
export type { default as PeerDependencyMeta } from './peer-dependency-meta'
20 changes: 20 additions & 0 deletions src/interfaces/peer-dependency-meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file Interfaces - PeerDependencyMeta
* @module pkg-types/interfaces/PeerDependencyMeta
*/

/**
* Peer dependency metadata.
*
* @see https://yarnpkg.com/configuration/manifest#peerDependenciesMeta
*/
interface PeerDependencyMeta {
/**
* Have package manager mark dependency as optional.
*
* A package consumer omitting the dependency will not raise an error.
*/
optional?: boolean
}

export type { PeerDependencyMeta as default }

0 comments on commit 78a4cbd

Please sign in to comment.