Closed maxmilton closed 2 years ago
Created a fix PR in https://github.com/maraisr/diary/pull/21.
I also suggest adding linting to this project which would catch bugs like this.
Yeah ouch... bad moment! Sorry about this. Ill get this out asap.
In terms of testing, yeah think I better — this hasn't been the first time. Thanks for jumping on it.
I think with this commit (https://github.com/maraisr/diary/commit/707d6873a98b3982696fa750e8973e7fcfdc24d3) we should now have tests for our types as well.
Thanks for the highlight.
also v0.4.3
has the fix applied.
Describe the bug
After https://github.com/maraisr/diary/commit/78334b38ac7a41e33169562c17829933fd2479b9 the types in https://github.com/maraisr/diary/blob/a723e0b203321faa6a95195c9991c2cf74c67427/src/index.d.ts are broken. Specifically, a type definition for
LogFnAsError
is now missing.This means that any use of
customLogger.error(...)
andcustomLogger.fatal(...)
in a typescript project doesn't work as expected.To reproduce
Typescript can't see any type definition for
LogFnAsError
and treats it asany
. When using@typescript-eslint/eslint-plugin
in a project, a lint error for the rule@typescript-eslint/no-unsafe-call
is emitted forcustomLogger.error
.Expected behavior
customLogger.error(...)
andcustomLogger.fatal(...)
are typed correctly.