-
Notifications
You must be signed in to change notification settings - Fork 898
fix(type): add disabled
to pino.LoggerOptions
#1629
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
fix(type): add disabled
to pino.LoggerOptions
#1629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test for this with tsd
?
disabled
to pino.LoggerOptions
disabled
to pino.LoggerOptions
Hi @mcollina - Sorry it has taken me an absolute age to circle back around on this. So interestingly, there is actually a pino/test/types/pino.test-d.ts Lines 88 to 108 in 062e30a
So in the case of this test, However, now that I've added a type for the This seems to be an issue with typescript using structural typing instead of nominal typing, extra keys are generally allowed when passing a type and so no error! A way around this seems to be to change the tests to not be instantiating pino instances but instead assigning to a variable of type const loggerOptions1: LoggerOptions = {
browser: {
write: {
info(o) {},
error(o) {},
},
serialize: true,
asObject: true,
transmit: {
level: "fatal",
send: (level, logEvent) => {
level;
logEvent.bindings;
logEvent.level;
logEvent.ts;
logEvent.messages;
},
},
disabled: false,
rubbish: 1, // Will error with a usually horrible looking typescript message!
},
}; However, this is being done all over the place and ties it to the specific defined types rather than use of the pino instantiation ... So over to you for if you want to make a change that big to the type checks! 😵💫
|
I'm sorry but I don't understand the problem, as all tests are currently passing. We need a new test for this change, and the current tests should keep passing to land this change. |
but @mcollina there was already a test where the I don't see any other tests anywhere that would check that a type for a property already exists for any other properties so this would be a change of approach in the project testing ... Do you want me to make a specific test for this one property even though none of the others are checked in this way? Or did I miss tests some where else? Sorry if I have! 🤦 |
The specific line that is testing the type of this property already! (But against no defined type without this PR) pino/test/types/pino.test-d.ts Line 106 in 062e30a
|
I don't understand the digression on adding tests for custom keys, it seems irrelevant to the issue at hand. Replying with "there is already a test at ..." would have been a good answer. What I do not understand is why the tests did not catch that property being missed. It's possible that all the above it's related to those, could you confirm? If that's the case, a follow up PR would be amazing, but this can land as is. |
All the above is indeed related to that! Basically I saw there was a test already for this property and went to find out why it wasn't failing ... That caused all of the afore mentioned digression!.. Agreed it would be a separate PR to fix this hole in testing and see if any other properties are missed in the type defs! Happy for this to be merged if you are! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
fixes #1628