Skip to content

Commit e467bfc

Browse files
committed
feat(interfaces): FundingObject
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent ef89d52 commit e467bfc

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @file Unit Tests - FundingObject
3+
* @module pkg-types/interfaces/tests/FundingObject
4+
*/
5+
6+
import type TestSubject from '../funding-object'
7+
8+
describe('unit:interfaces/FundingObject', () => {
9+
const url: string = 'https://github.com/sponsors/flex-development'
10+
11+
it('should allow object that only has property "url"', () => {
12+
assertType<TestSubject>({ url })
13+
})
14+
15+
it('should allow object with funding account url and funding type', () => {
16+
assertType<Required<TestSubject>>({ type: 'github', url })
17+
})
18+
})

src/interfaces/funding-object.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @file Interfaces - FundingObject
3+
* @module pkg-types/interfaces/FundingObject
4+
*/
5+
6+
import type { FundingType } from '#src/types'
7+
8+
/**
9+
* Object containing information about how to support a package monetarily.
10+
*
11+
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#funding
12+
*/
13+
interface FundingObject {
14+
/**
15+
* Package funding type.
16+
*/
17+
type?: FundingType
18+
19+
/**
20+
* URL to funding account for package.
21+
*/
22+
url: string
23+
}
24+
25+
export type { FundingObject as default }

src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
export type { default as BugsObject } from './bugs-object'
77
export type { default as DependencyMeta } from './dependency-meta'
8+
export type { default as FundingObject } from './funding-object'
89
export type { default as InstallConfig } from './install-config'
910
export type { default as PeerDependencyMeta } from './peer-dependency-meta'
1011
export type { default as WorkspacesConfig } from './workspaces-config'

0 commit comments

Comments
 (0)