Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions @commitlint/format/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function formatResult(
const problems = [...errors, ...warnings].map((problem) => {
const sign = signs[problem.level] || '';
const color: ChalkColor = colors[problem.level] || ('white' as const);
const decoration = enabled ? ((chalk as any)[color] as any)(sign) : sign;
const decoration = enabled ? chalk[color](sign) : sign;
const name = enabled
? chalk.grey(`[${problem.name}]`)
: `[${problem.name}]`;
Expand All @@ -76,7 +76,7 @@ export function formatResult(
const sign = selectSign(result);
const color = selectColor(result);

const deco = enabled ? (chalk[color] as any)(sign) : sign;
const deco = enabled ? chalk[color](sign) : sign;
const el = errors.length;
const wl = warnings.length;
const hasProblems = problems.length > 0;
Expand Down Expand Up @@ -109,7 +109,7 @@ function selectSign(result: FormattableResult): string {
return (result.warnings || []).length ? '⚠' : '✔';
}

function selectColor(result: FormattableResult): keyof typeof chalk {
function selectColor(result: FormattableResult): ChalkColor {
if ((result.errors || []).length > 0) {
return 'red';
}
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/types/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface FormattableReport {
results?: (FormattableResult & WithInput)[];
}

export type ChalkColor = keyof typeof chalk;
export type ChalkColor = typeof chalk.Color | typeof chalk.Modifiers;

export interface FormatOptions {
color?: boolean;
Expand Down