-
Notifications
You must be signed in to change notification settings - Fork 937
Closed
Description
The new TypeScript types introduced in #2230 are much more strict than the functions accept, causing many false-positive typing errors in TypeScript code using Pino. #2259 is one example, but the overstrictness seems to go much farther.
- The
%sspecifier inutil.formatwill callobj.toString()if the object provides atoString()method, but the new typing rejects such objects as input to%s. Arbitrary objects withtoString()are very useful when logging custom objects that have a natural string representation, such as a path or URL object. %Oand friends acceptundefined(printingundefined) andnull, but neither is allowed by the TypeScript types.
As near as I can tell, any JavaScript type seems to be valid input to %s, %O, and %o in util.format, so it seems that any would be a better input type for these format specifiers.
The result of this overstrictness is that code that type-checked prior to 9.8, and runs fine, now fails to typecheck with numerous errors (184 errors in 10K SLOC in one of my projects, that are spurious as far as I can tell).
SimonGolms, Cappo, akselinurmio, snrmwg, chrisbenincasa and 1 more
Metadata
Metadata
Assignees
Labels
No labels