Skip to content

Commit db81a3e

Browse files
committed
fix: wrong logging
1 parent 1d57518 commit db81a3e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/nuxt/src/logging.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ export type LogType = 'debug' | 'info' | 'warn' | 'error' | 'trace'
55
export function log(type: LogType, ...args: any[]): void
66
export function log(...args: any[]): void
77
export function log(typeOrLog?: unknown, ...args: any[]): void {
8-
const type = typeof typeOrLog === 'string' ? (typeOrLog as LogType) : 'log'
8+
const type = isLogType(typeOrLog) ? typeOrLog : 'log'
99
console[type]('[VueFire]:', ...args)
1010
}
11+
12+
function isLogType(type: unknown): type is LogType {
13+
return (
14+
typeof type === 'string' &&
15+
(type === 'debug' ||
16+
type === 'info' ||
17+
type === 'warn' ||
18+
type === 'error' ||
19+
type === 'trace')
20+
)
21+
}

0 commit comments

Comments
 (0)