Skip to content

Commit

Permalink
fix(interfaces): make ParsedPath work as expected with `--exactOpti…
Browse files Browse the repository at this point in the history
…onalPropertyTypes`

- https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes

Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Dec 20, 2022
1 parent 031cab5 commit 066665a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
21 changes: 18 additions & 3 deletions src/interfaces/__tests__/parsed-path.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@
*/

import type TestSubject from '../parsed-path'
import type PathObject from '../path-object'

describe('unit-d:interfaces/ParsedPath', () => {
it('should extend Required<PathObject>', () => {
expectTypeOf<TestSubject>().toMatchTypeOf<Required<PathObject>>()
it('should match [base: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('base').toBeString()
})

it('should match [dir: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('dir').toBeString()
})

it('should match [ext: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('ext').toBeString()
})

it('should match [name: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('name').toBeString()
})

it('should match [root: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('root').toBeString()
})
})
5 changes: 3 additions & 2 deletions src/interfaces/parsed-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module pathe/interfaces/ParsedPath
*/

import type { ExactOptionalPropertyTypes } from '@flex-development/tutils'
import type PathObject from './path-object'

/**
Expand All @@ -16,8 +17,8 @@ import type PathObject from './path-object'
*
* @see [`PathObject`][3]
*
* @extends {Required<PathObject>}
* @extends {ExactOptionalPropertyTypes<Required<PathObject>>}
*/
interface ParsedPath extends Required<PathObject> {}
interface ParsedPath extends ExactOptionalPropertyTypes<Required<PathObject>> {}

export type { ParsedPath as default }
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"declarationMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"exactOptionalPropertyTypes": false,
"exactOptionalPropertyTypes": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
Expand Down
6 changes: 6 additions & 0 deletions tsconfig.typecheck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"target": "es2020"
},
"extends": "./tsconfig.json"
}
2 changes: 1 addition & 1 deletion typings/conventional-commits-parser/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ declare module 'conventional-commits-parser' {
export interface Commit extends CommitRaw {
raw: CommitRaw
shortHash: string
version?: string
version?: string | undefined
}
}

0 comments on commit 066665a

Please sign in to comment.