question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[`PINO` BUG] wrong export of types in `pino` package

See original GitHub issue

[x] I’ve read the docs of nestjs-pino

[x] I’ve read the docs of pino

[x] I couldn’t find the same open issue of nestjs-pino

What is the current behavior? When skipLibCheck is disabled in tsconfig.json compilation fails.

node_modules/nestjs-pino/params.d.ts:3:10 - error TS2614: Module '"pino"' has no exported member 'DestinationStream'. Did you mean to use 'import DestinationStream from "pino"' instead?

3 import { DestinationStream } from 'pino';
           ~~~~~~~~~~~~~~~~~

node_modules/nestjs-pino/params.d.ts:6:18 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino/pino"' has no exported member 'Logger'.

6     logger: pino.Logger;
                   ~~~~~~

node_modules/nestjs-pino/params.d.ts:13:25 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino-http/index"' has no exported member 'Options'.

13     pinoHttp?: pinoHttp.Options | DestinationStream | [pinoHttp.Options, DestinationStream];
                           ~~~~~~~

node_modules/nestjs-pino/params.d.ts:13:65 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino-http/index"' has no exported member 'Options'.

13     pinoHttp?: pinoHttp.Options | DestinationStream | [pinoHttp.Options, DestinationStream];
                                                                   ~~~~~~~

node_modules/nestjs-pino/PinoLogger.d.ts:3:38 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino/pino"' has no exported member 'BaseLogger'.

3 declare type PinoMethods = Pick<pino.BaseLogger, 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
                                       ~~~~~~~~~~

node_modules/nestjs-pino/PinoLogger.d.ts:11:32 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino/pino"' has no exported member 'Logger'.

11     static readonly root: pino.Logger;
                                  ~~~~~~

node_modules/nestjs-pino/PinoLogger.d.ts:29:24 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino/pino"' has no exported member 'Logger'.

29     get logger(): pino.Logger;
                          ~~~~~~

node_modules/nestjs-pino/PinoLogger.d.ts:30:25 - error TS2694: Namespace '"/nestjs-pino-bug/node_modules/pino/pino"' has no exported member 'Bindings'.

30     assign(fields: pino.Bindings): void;

What is the expected behavior? Library should work independently from skipLibCheck config flag.

Please provide minimal example repo. Without it this issue will be closed https://github.com/antspk/nestjs-pino-bug

Please mention other relevant information such as Node.js version and Operating System. node v16.13.0 macos 12.0.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
iamoleggacommented, Dec 14, 2021

finally, all the types are fixed in v2.4.0. Big thanks to @jarcodallo . Unpinning this issue

4reactions
iamoleggacommented, Nov 24, 2021

OK, so pino-team had decided to move the types from @types/pino to the lib’s .d.ts file. Without backward compatibility

Subscribe to this issue and switch skipLibCheck until it’s fixed.

As this is not a bug of the current library I’m closing, but will pin it until it’s fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New bundled TypeScript typings do not expose various top ...
As I commented in #910, the bundled TypeScript type definitions do not allow import ... [ PINO BUG] wrong export of types in...
Read more >
A Complete Guide to Pino Logging in Node.js - Better Stack
This code requires the pino package and exports a pino() function that takes two optional arguments, options and destination , and returns a ......
Read more >
Node.js logging best practices: The essential guide
Logging using Node.js can save hours of debugging work. Here are logging best practices and our recommendations for the best logging tools.
Read more >
@types/pino - npm
Start using @types/pino in your project by running `npm i @types/pino`. There are 309 other projects in ... This package has been deprecated....
Read more >
Re-export third party definitions in typescript npm module
I think the answer is to include @types/pino as a dependency in the package.json of the module, so it's installed alongside the logging ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found