1- import chalk , { Chalk } from 'chalk' ;
1+ import chalk , { Chalk , ChalkInstance } from 'chalk' ;
22import Rx from 'rxjs' ;
33
44import { Command , CommandIdentifier } from './command.js' ;
@@ -7,12 +7,12 @@ import * as defaults from './defaults.js';
77import { escapeRegExp } from './utils.js' ;
88
99const defaultChalk = chalk ;
10- const noColorChalk = new chalk . Instance ( { level : 0 } ) ;
10+ const noColorChalk = new Chalk ( { level : 0 } ) ;
1111
12- function getChalkPath ( chalk : Chalk , path : string ) : Chalk | undefined {
12+ function getChalkPath ( chalk : ChalkInstance , path : string ) : ChalkInstance | undefined {
1313 return path
1414 . split ( '.' )
15- . reduce ( ( prev , key ) => ( prev as unknown as Record < string , Chalk > ) [ key ] , chalk ) ;
15+ . reduce ( ( prev , key ) => ( prev as unknown as Record < string , ChalkInstance > ) [ key ] , chalk ) ;
1616}
1717
1818export class Logger {
@@ -22,7 +22,7 @@ export class Logger {
2222 private readonly commandLength : number ;
2323 private readonly dateFormatter : DateFormatter ;
2424
25- private chalk : Chalk = defaultChalk ;
25+ private chalk = defaultChalk ;
2626
2727 /**
2828 * How many characters should a prefix have.
@@ -154,7 +154,7 @@ export class Logger {
154154 }
155155
156156 colorText ( command : Command , text : string ) {
157- let color : chalk . Chalk ;
157+ let color : ChalkInstance ;
158158 if ( command . prefixColor ?. startsWith ( '#' ) ) {
159159 const [ hexColor , ...modifiers ] = command . prefixColor . split ( '.' ) ;
160160 color = this . chalk . hex ( hexColor ) ;
@@ -163,7 +163,7 @@ export class Logger {
163163 color = modifiedColor ;
164164 }
165165 } else {
166- const defaultColor = getChalkPath ( this . chalk , defaults . prefixColors ) as Chalk ;
166+ const defaultColor = getChalkPath ( this . chalk , defaults . prefixColors ) as ChalkInstance ;
167167 color = getChalkPath ( this . chalk , command . prefixColor ?? '' ) ?? defaultColor ;
168168 }
169169 return color ( text ) ;
0 commit comments