Skip to content

Commit

Permalink
feat(types): Type
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Nov 30, 2022
1 parent 6b08cbf commit 94ce708
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/types/__tests__/type.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @file Unit Tests - Type
* @module pkg-types/types/tests/Type
*/

import type TestSubject from '../type'

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

it('should allow "module"', () => {
assertType<TestSubject>('module')
})
})
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

export type { default as Access } from './access'
export type { default as HoistingLimits } from './hoisiting-limits'
export type { default as Type } from './type'
export type { default as TypesVersions } from './types-versions'
15 changes: 15 additions & 0 deletions src/types/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @file Type Definitions - Type
* @module pkg-types/types/Type
*/

/**
* Module format used by Node.js for all `.js` files that have a `package.json`
* file as their nearest parent.
*
* @see https://nodejs.org/api/packages.html#type
* @see https://nodejs.org/api/esm.html#esm_package_json_type_field
*/
type Type = 'commonjs' | 'module'

export type { Type as default }

0 comments on commit 94ce708

Please sign in to comment.