Skip to content

Please export logger type from sidequest package #156

@frederikheld

Description

@frederikheld

I'd like to pass the logger as a parameter into my functions.

Right now, the only way to type the parameter seems to be like this:

const someFunction(log: ReturnType<typeof logger>) {}

This feels a bit clunky and hides the actual type.

I would prefer to type is as winston.Logger, which is the return type of the logger function but I'd also like to avoid to install Winston separately just to get the type (let alone the issues TypeScript has with using types across packages).

So this is how I'd like to use it:

import type { winston } from 'sidequest'

const someFunction(log: winston.Logger) {}

Or maybe even shorter just like this:

import type { Logger } from 'sidequest'

const someFunction(log: Logger) {}

The latter would allow you to internally replace the logger if you want to move away from winston at some point.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions