File tree 3 files changed +19
-10
lines changed
3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change
1
+ import { LogHandler } from './index'
2
+
3
+ declare global {
4
+ namespace NodeJS {
5
+ interface Global {
6
+ _logga ?: LogHandler [ ]
7
+ }
8
+ }
9
+
10
+ interface Window {
11
+ _logga ?: LogHandler [ ]
12
+ }
13
+ }
Original file line number Diff line number Diff line change @@ -48,26 +48,23 @@ export interface LogHandler {
48
48
49
49
// Global `logga` instance
50
50
51
- const root =
51
+ const root : NodeJS . Global | Window =
52
52
typeof window !== 'undefined'
53
53
? window
54
54
: typeof global !== 'undefined'
55
55
? global
56
56
: // Ignore in coverage because is expected to be unreachable
57
57
// istanbul ignore next
58
- { }
58
+ ( { } as typeof global )
59
59
60
60
function Logga ( ) : LogHandler [ ] {
61
61
const name = '_logga'
62
62
if ( name in root ) {
63
- // istanbul ignore next
64
- // @ts -ignore
65
- return root [ name ] as LogHandler [ ]
63
+ return root [ name ] ?? [ ]
66
64
}
67
- // @ts -ignore
65
+
68
66
root [ name ] = [ ]
69
- // @ts -ignore
70
- return root [ name ] as LogHandler [ ]
67
+ return root [ name ] ?? [ ]
71
68
}
72
69
73
70
const logga : LogHandler [ ] = Logga ( )
@@ -334,7 +331,6 @@ if (handlers().length === 0) addHandler(defaultHandler)
334
331
*
335
332
* @param tag The unique application or package name
336
333
*/
337
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
338
334
export function getLogger ( tag : string ) : Logger {
339
335
return {
340
336
error ( message : string | LogEvent ) {
Original file line number Diff line number Diff line change 5
5
"moduleResolution" : " node" ,
6
6
"outDir" : " ./dist/lib"
7
7
},
8
- "files" : [" index.ts" ]
8
+ "files" : [" index.ts" , " index.d.ts " ]
9
9
}
You can’t perform that action at this time.
0 commit comments