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

Change typing of logLevel argument to logCreator #538

Merged
merged 2 commits into from
Oct 31, 2019

Conversation

johan13
Copy link
Contributor

@johan13 johan13 commented Oct 31, 2019

The kafkajs log levels are numeric at runtime, but the typescript declarations for the logCreator function takes a string argument. This PR changes the argument's type and adds a test for it.

types/index.d.ts Outdated
@@ -364,7 +364,7 @@ export interface LoggerEntryContent {

export type Logger = (entry: LogEntry) => void

export type logCreator = (logLevel: string) => (entry: LogEntry) => void
export type logCreator = (logLevel: number) => (entry: LogEntry) => void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be using the logLevel enum instead of number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right!

@Nevon Nevon added the bug label Oct 31, 2019
@Nevon
Copy link
Collaborator

Nevon commented Oct 31, 2019

Thanks for the contribution! Just a question about whether or not we can restrict the type to the appropriate enum.

@Nevon Nevon merged commit 34824cb into tulios:master Oct 31, 2019
@Nevon
Copy link
Collaborator

Nevon commented Oct 31, 2019

This is available in the pre-release version 1.12.0-beta.3.

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

Successfully merging this pull request may close these issues.

2 participants