Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PINO BUG] wrong export of types in pino package #680

Closed
antspk opened this issue Nov 23, 2021 · 10 comments
Closed

[PINO BUG] wrong export of types in pino package #680

antspk opened this issue Nov 23, 2021 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@antspk
Copy link
Contributor

antspk commented Nov 23, 2021

[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

@antspk antspk added the bug Something isn't working label Nov 23, 2021
@iamolegga
Copy link
Owner

could be caused by DefinitelyTyped/DefinitelyTyped#57023

will check soon

@tomups
Copy link
Contributor

tomups commented Nov 23, 2021

Having this problem too

@tomoat
Copy link

tomoat commented Nov 24, 2021

me too

@iamolegga
Copy link
Owner

@tomtastico @tomoat "+1" on the first message is enough

@iamolegga
Copy link
Owner

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.

@iamolegga iamolegga changed the title [BUG] skipLibCheck causes compilation to fail [PINO BUG] wrong export of types in pino package Nov 24, 2021
@iamolegga iamolegga pinned this issue Nov 24, 2021
@FredericEspiau
Copy link

@iamolegga pinojs/pino#1193 (comment) it's been fixed

@iamolegga
Copy link
Owner

@FredericEspiau thanks, already seen this too. Will check soon

@iamolegga
Copy link
Owner

It looks like not everything was fixed https://github.com/iamolegga/nestjs-pino/runs/4361882493?check_suite_focus=true
WIll check manually when I get time on this

@iamolegga
Copy link
Owner

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

@iamolegga iamolegga unpinned this issue Dec 14, 2021
@FredericEspiau
Copy link

Thanks for the awesome work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants