Skip to content

Commit e5c60ab

Browse files
committed
fix(prompt): small type improvement
1 parent 9c67c3b commit e5c60ab

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

@commitlint/prompt/src/library/format.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from 'chalk';
2-
import {Result} from './types';
2+
import {Result, ResultPart} from './types';
33

44
/**
55
* Get formatted commit message
@@ -18,7 +18,7 @@ export default function format(input: Result, debug = false): string {
1818
};
1919
const results = debug
2020
? Object.entries(defaultInput).reduce<Result>((registry, [name, value]) => {
21-
registry[name as 'type' | 'scope' | 'subject' | 'body' | 'footer'] =
21+
registry[name as ResultPart] =
2222
value === undefined ? chalk.grey(`<${name}>`) : chalk.bold(value);
2323
return registry;
2424
}, {})

@commitlint/prompt/src/library/get-prompt.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import chalk from 'chalk';
22

33
import {InputCustomOptions, InputQuestion, ListQuestion} from 'inquirer';
44

5-
import type {InputSetting, RuleEntry, Result} from './types';
5+
import type {InputSetting, RuleEntry, Result, ResultPart} from './types';
66

77
import format from './format';
88
import getForcedCaseFn from './get-forced-case-fn';
@@ -27,7 +27,7 @@ const EOL = '\n';
2727
* @return prompt instance
2828
*/
2929
export default function getPrompt(
30-
type: 'type' | 'scope' | 'subject' | 'body' | 'footer',
30+
type: ResultPart,
3131
rules: RuleEntry[] = [],
3232
settings: InputSetting = {}
3333
):

@commitlint/prompt/src/library/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export type InputSetting = {
1919
};
2020
};
2121

22-
export type Result = Partial<
23-
Record<'type' | 'scope' | 'subject' | 'body' | 'footer', string | undefined>
24-
>;
22+
export type ResultPart = 'type' | 'scope' | 'subject' | 'body' | 'footer';
23+
24+
export type Result = Partial<Record<ResultPart, string | undefined>>;

0 commit comments

Comments
 (0)