Skip to content

Commit

Permalink
Add a test for browser.formatters type
Browse files Browse the repository at this point in the history
  • Loading branch information
KatelynKim committed Apr 26, 2024
1 parent edfd53c commit f42308a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/types/pino-type-only.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expectAssignable, expectType, expectNotAssignable } from "tsd";

import pino from "../../";
import type {LevelWithSilent, Logger, LogFn, P, DestinationStreamWithMetadata, Level, LevelOrString, LevelWithSilentOrString, LoggerExtras } from "../../pino";
import type {LevelWithSilent, Logger, LogFn, P, DestinationStreamWithMetadata, Level, LevelOrString, LevelWithSilentOrString, LoggerExtras, LoggerOptions } from "../../pino";

// NB: can also use `import * as pino`, but that form is callable as `pino()`
// under `esModuleInterop: false` or `pino.default()` under `esModuleInterop: true`.
Expand Down Expand Up @@ -46,3 +46,19 @@ const needsMetadata: typeof pino.symbols.needsMetadataGsym = pino.symbols.needsM
if (stream[needsMetadata]) {
expectType<number>(stream.lastLevel);
}

const loggerOptions:LoggerOptions = {
browser: {
formatters: {
log(obj) {
return obj
},
level(label, number) {
return { label, number}
}

}
}
}

expectType<LoggerOptions>(loggerOptions)

0 comments on commit f42308a

Please sign in to comment.