Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pino.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ declare namespace pino {
type PlaceholderTypeMapping<T extends PlaceholderSpecifier> = T extends 'd'
? number
: T extends 's'
? string | number | boolean | bigint | null | undefined | symbol
? string | number | boolean | bigint | null | undefined | symbol | object
: T extends 'j' | 'o' | 'O'
? object
: never;
Expand Down Expand Up @@ -878,4 +878,4 @@ declare function pino<CustomLevels extends string = never, UseOnlyCustomLevels e
*/
declare function pino<CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean>(options: pino.LoggerOptions<CustomLevels, UseOnlyCustomLevels>, stream?: pino.DestinationStream | undefined): pino.Logger<CustomLevels, UseOnlyCustomLevels>;

export = pino;
export = pino;
5 changes: 3 additions & 2 deletions test/types/pino.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ info({ a: 1, b: '2' }, 'hello world with %s', 'extra data');
// Extra message after placeholder
expectError(info({ a: 1, b: '2' }, 'hello world with %d', 2, 'extra' ));

// metadata with messages type errors
expectError(info({ a: 1, b: '2' }, 'hello world with %s', {}));
// metadata with messages type passes, because of custom toString method
// We can't detect if the object has a custom toString method that returns a string
info({ a: 1, b: '2' }, 'hello world with %s', {});

// metadata after message
expectError(info('message', { a: 1, b: '2' }));
Expand Down
Loading