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

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

Closed
hugo-daclon opened this issue Jul 19, 2023 · 5 comments · Fixed by #2334
Closed

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

hugo-daclon opened this issue Jul 19, 2023 · 5 comments · Fixed by #2334

Comments

@hugo-daclon
Copy link

hugo-daclon commented Jul 19, 2023

🔎 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.

@hugo-daclon hugo-daclon changed the title [Bug]: FileTransportOptions type not updated after #2317 [Bug]: FileTransportOptions type missing lazy:boolean option Jul 19, 2023
@DABH
Copy link
Contributor

DABH commented Jul 19, 2023

Can you just open a PR for the required TS fix, and I can merge and do a patch release?

@hugo-daclon
Copy link
Author

hugo-daclon commented Jul 19, 2023

Can you just open a PR for the required TS fix, and I can merge and do a patch release?

I don't know how to use github 😞
Before the issue I tried creating a PR but couldn't create a branch

@Pulkit0729
Copy link
Contributor

No issue i will create a PR for it.

@Pulkit0729
Copy link
Contributor

Hey @DABH , please review the above PR

@hugo-daclon
Copy link
Author

Thanks to you both, for the quick response. When will this change be released ?

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

Successfully merging a pull request may close this issue.

3 participants