We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d57518 commit db81a3eCopy full SHA for db81a3e
packages/nuxt/src/logging.ts
@@ -5,6 +5,17 @@ export type LogType = 'debug' | 'info' | 'warn' | 'error' | 'trace'
5
export function log(type: LogType, ...args: any[]): void
6
export function log(...args: any[]): void
7
export function log(typeOrLog?: unknown, ...args: any[]): void {
8
- const type = typeof typeOrLog === 'string' ? (typeOrLog as LogType) : 'log'
+ const type = isLogType(typeOrLog) ? typeOrLog : 'log'
9
console[type]('[VueFire]:', ...args)
10
}
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