Skip to content

Commit

Permalink
feat(types): TypesVersions
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 a566375 commit ffd3e52
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@
const config = {
root: true,
extends: ['./.eslintrc.base.cjs'],
overrides: [...require('./.eslintrc.base.cjs').overrides]
overrides: [
...require('./.eslintrc.base.cjs').overrides,
{
files: ['./src/types/__tests__/types-versions.spec-d.ts'],
rules: {
'sort-keys': 0
}
}
]
}

module.exports = config
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* @module pkg-types
*/

export {}
export * from './types'
20 changes: 20 additions & 0 deletions src/types/__tests__/types-versions.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file Unit Tests - TypesVersions
* @module pkg-types/types/tests/TypesVersions
*/

import type TestSubject from '../types-versions'

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

it('should allow object with version mappings', () => {
assertType<TestSubject>({
'>=4.0': { '*': ['ts4.0/*'] },
'>=3.2': { '*': ['ts3.2/*'] },
'>=3.1': { '*': ['ts3.1/*'] }
})
})
})
6 changes: 6 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @file Entry Point - Type Definitions
* @module tsconfig-types/types
*/

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

/**
* TypeScript version selection map.
*
* @see https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions
*/
type TypesVersions = Partial<Record<string, Partial<Record<string, string[]>>>>

export type { TypesVersions as default }

0 comments on commit ffd3e52

Please sign in to comment.