🔎 Search Terms
types, alert
The problem
@wbt removed types in the following commit: c3c3911
I now get typescript and eslint errors when using the logger with syslog levels
What version of Winston presents the issue?
v3.12.0
What version of Node are you using?
v18.19.0
If this worked in a previous version of Winston, which was it?
3.11.0
Minimum Working Example
const logger = createLogger({levels: config.syslog.levels, transports: [new transports.Console()]})
logger.alert('my alert message')
// ^Unsafe call of an `any` typed value.eslint[@typescript-eslint/no-unsafe-call](https://typescript-eslint.io/rules/no-unsafe-call)
// ^Property 'alert' does not exist on type 'Logger'.ts(2339)
Additional information
You can either:
- put them back or mark them (along with every
LeveledLogMethod) as optional.
- try and work some typescript magic to detect what methods to include depending on the config value of levels. maybe something like making the logger type generic with a
<levels extends Config.AbstractConfigSetLevels> and a [level: keyof levels]: LeveledLogMethod (I didn't try this, but intuitively it should work)
🔎 Search Terms
types, alert
The problem
@wbt removed types in the following commit: c3c3911
I now get typescript and eslint errors when using the logger with syslog levels
What version of Winston presents the issue?
v3.12.0
What version of Node are you using?
v18.19.0
If this worked in a previous version of Winston, which was it?
3.11.0
Minimum Working Example
Additional information
You can either:
LeveledLogMethod) as optional.<levels extends Config.AbstractConfigSetLevels>and a[level: keyof levels]: LeveledLogMethod(I didn't try this, but intuitively it should work)