-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
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
Labels
No labels