@@ -46,23 +46,7 @@ export interface PersistOptions {
46
46
text ?: string ;
47
47
}
48
48
49
- export interface Console {
50
- log : typeof console . log ;
51
- warn : typeof console . warn ;
52
- error : typeof console . error ;
53
- info : typeof console . info ;
54
- debug : typeof console . debug ;
55
- time : typeof console . time ;
56
- timeEnd : typeof console . timeEnd ;
57
- trace : typeof console . trace ;
58
- dir : typeof console . dir ;
59
- assert : typeof console . assert ;
60
- count : typeof console . count ;
61
- countReset : typeof console . countReset ;
62
- table : typeof console . table ;
63
- dirxml : typeof console . dirxml ;
64
- timeLog : typeof console . timeLog ;
65
- }
49
+ export type Console = typeof globalThis . console ;
66
50
67
51
export function wait ( opts : string | SpinnerOptions ) : Spinner {
68
52
if ( typeof opts === "string" ) {
@@ -140,24 +124,31 @@ export class Spinner {
140
124
#interceptConsole( ) : void {
141
125
const methods : ( keyof Console ) [ ] = [
142
126
"log" ,
143
- "warn" ,
144
- "error" ,
145
- "info" ,
146
127
"debug" ,
147
- "time" ,
148
- "timeEnd" ,
149
- "trace" ,
128
+ "info" ,
150
129
"dir" ,
130
+ "dirxml" ,
131
+ "warn" ,
132
+ "error" ,
151
133
"assert" ,
152
134
"count" ,
153
135
"countReset" ,
154
136
"table" ,
155
- "dirxml " ,
137
+ "time " ,
156
138
"timeLog" ,
139
+ "timeEnd" ,
140
+ "group" ,
141
+ "groupCollapsed" ,
142
+ "groupEnd" ,
143
+ "clear" ,
144
+ "trace" ,
145
+ "profile" ,
146
+ "profileEnd" ,
147
+ "timeStamp" ,
157
148
] ;
158
149
for ( const method of methods ) {
159
- const original = ( console as Console ) [ method ] ;
160
- ( console as Console ) [ method ] = ( ...args : unknown [ ] ) => {
150
+ const original = console [ method ] as ( ... args : unknown [ ] ) => void ;
151
+ console [ method ] = ( ...args : unknown [ ] ) => {
161
152
if ( this . isSpinning ) {
162
153
this . stop ( ) ;
163
154
this . clear ( ) ;
0 commit comments