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

Typescript definitions #118

Open
jmealo opened this issue Sep 7, 2022 · 3 comments
Open

Typescript definitions #118

jmealo opened this issue Sep 7, 2022 · 3 comments

Comments

@jmealo
Copy link

jmealo commented Sep 7, 2022

Hello,

It would be useful if this project included typescript definitions and updated usage examples for ES modules.

Thanks,
Jeff

@jmealo
Copy link
Author

jmealo commented Sep 7, 2022

In the meantime, I believe preloading pino-debug with a command line switch is probably your best bet for these type of projects. I haven't tested this yet but will report back.

@colesiegel
Copy link

colesiegel commented Nov 21, 2022

I got it to work the programmatic way like this:

mymodule
dependencies: debug

import debugModule from 'debug';
export const debug = debugModule('mymodule');
debug('hi from mymodule');

parent project
dependencies: pino, pino-debug

import pinoDebug from 'pino-debug';
# logger is an instance of pino.Logger
import logger from './logger';

pinoDebug(logger, {
  auto: false,
  map: {
    'mymodule': 'info',
  },
});

.env

DEBUG=mymodule

Maybe it will help someone as it took me a bit of trial and error.

@kamatheuska
Copy link

While there is no definitions, you can add your own as described here: https://www.typescriptlang.org/docs/handbook/2/type-declarations.html#your-own-definitions

basically, create an index.d.ts and add this

declare module 'pino-debug';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants