Skip to content

Commit

Permalink
feat(types): OS
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Nov 30, 2022
1 parent e6e4cd5 commit a6b42c7
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
72 changes: 72 additions & 0 deletions src/types/__tests__/os.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* @file Unit Tests - OS
* @module pkg-types/types/tests/OS
*/

import type TestSubject from '../os'

describe('unit:types/OS', () => {
it('should allow "aix"', () => {
assertType<TestSubject>('aix')
})

it('should allow "darwin"', () => {
assertType<TestSubject>('darwin')
})

it('should allow "freebsd"', () => {
assertType<TestSubject>('freebsd')
})

it('should allow "linux"', () => {
assertType<TestSubject>('linux')
})

it('should allow "openbsd"', () => {
assertType<TestSubject>('openbsd')
})

it('should allow "sunos"', () => {
assertType<TestSubject>('sunos')
})

it('should allow "ppc64"', () => {
assertType<TestSubject>('ppc64')
})

it('should allow "win32"', () => {
assertType<TestSubject>('win32')
})

it('should allow "!aix"', () => {
assertType<TestSubject>('!aix')
})

it('should allow "!darwin"', () => {
assertType<TestSubject>('!darwin')
})

it('should allow "!freebsd"', () => {
assertType<TestSubject>('!freebsd')
})

it('should allow "!linux"', () => {
assertType<TestSubject>('!linux')
})

it('should allow "!openbsd"', () => {
assertType<TestSubject>('!openbsd')
})

it('should allow "!sunos"', () => {
assertType<TestSubject>('!sunos')
})

it('should allow "!ppc64"', () => {
assertType<TestSubject>('!ppc64')
})

it('should allow "!win32"', () => {
assertType<TestSubject>('!win32')
})
})
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type { default as CPU } from './cpu'
export type { default as Engine } from './engine'
export type { default as ExportCondition } from './export-condition'
export type { default as HoistingLimits } from './hoisiting-limits'
export type { default as OS } from './os'
export type { default as Registry } from './registry'
export type { default as Type } from './type'
export type { default as TypesVersions } from './types-versions'
25 changes: 25 additions & 0 deletions src/types/os.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @file Type Definitions - OS
* @module pkg-types/types/OS
*/

import type { EmptyString, LiteralUnion } from '@flex-development/tutils'

/**
* Operating system platforms a package runs on.
*
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#os
* @see https://yarnpkg.com/configuration/manifest#os
*/
type OS = LiteralUnion<
| `${EmptyString | '!'}aix`
| `${EmptyString | '!'}darwin`
| `${EmptyString | '!'}freebsd`
| `${EmptyString | '!'}linux`
| `${EmptyString | '!'}openbsd`
| `${EmptyString | '!'}sunos`
| `${EmptyString | '!'}win32`,
string
>

export type { OS as default }

0 comments on commit a6b42c7

Please sign in to comment.