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

rejections property missing from types #1928

Open
svaj opened this issue Jun 7, 2021 · 3 comments
Open

rejections property missing from types #1928

svaj opened this issue Jun 7, 2021 · 3 comments

Comments

@svaj
Copy link

svaj commented Jun 7, 2021

Please tell us about your environment:

winston version? 3.2.1
    winston@2
    winston@3
node -v outputs: v14.15.4
Operating System? (Windows, macOS, or Linux) macOS
Language? (all | TypeScript X.X | ES6/7 | ES5 | Dart) Typescript 4.3.2

What is the problem?

The rejections property (set at runtime

this.rejections = new RejectionHandler(this);
) is not present in the type definition for Logger
What do you expect to happen instead?

I'd expect the rejections property to be defined as rejections: ExceptionHandler;rejections: RejectionHandler;.
Other information

I ran into this issue while trying to ensure winston's uncaught exceptions and unhandled rejection handlers were the first listeners for those events. Apparently Google cloud function's framework sets listeners for those that call process.exit()... I'd like my errors to be logged nicely, by winston, before the cloud function framework blows up. After writing some code to ensure wintson's listeners were first, tsc let me know that rejections wasn't defined on Logger!

@glensc
Copy link

glensc commented Jan 13, 2022

older version of the fix (4 Sep 2020):

@DABH
Copy link
Contributor

DABH commented Jan 13, 2022

We are trying to coalesce the 4-5 PRs that solve this into one best candidate and then merge it…

@wbt
Copy link
Contributor

wbt commented Jan 13, 2022

I ran into this issue while trying to ensure winston's uncaught exceptions and unhandled rejection handlers were the first listeners for those events.

I would recommend not relying on that, with an example reason described here in addition to the example you gave.

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