Skip to content

[Bug]: FileTransportOptions type missing lazy:boolean option #2333

@hugo-daclon

Description

@hugo-daclon

🔎 Search Terms

lazy, FileTransportOptions, .d.ts

The problem

Hello winston team.

On #2317 An option was added on the file transport for 3.10.0 called "lazy". It works well, except.... in typescript were I get this type error :

Argument of type '{ level: string; filename: string; lazy: boolean; format: Format; zippedArchive: true; maxFiles: number; tailable: true; }' is not assignable to parameter of type 'FileTransportOptions'.
  Object literal may only specify known properties, and 'lazy' does not exist in type 'FileTransportOptions'.ts(2345)

I looked into it and found out that @Pulkit0729 and @DABH just forgot to modify lib/winston/transports/index.d.ts:26.

I also looked at lib/winston/transports/file.js in my node_modules and found the changes of the mentioned PR. So it really is a sad mistake.

I was so happy to finally be able to prevent winston from creating useless empty files. But I can't compile my changes because of this typo😢.

Could you give me a estimate of when the patch will be available to install ?

What version of Winston presents the issue?

v3.10.0

What version of Node are you using?

v20.4.0

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

import { transports, format } from winston
new transports.File({
    level: 'info',
    filename: 'any.log',
    lazy: true,
    format: format.simple()
})

there should be a ts(2345) on line 5 col 5

Additional information

This issue could also be exposing some CI issues regarding TS support. I didn't really explore this part so I'll trust your process. But it might be a recuring problem (if it didn't already happen). On my project, I now always use typescript in my test because this type of issue happened to me more than one time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions