Skip to content

Commit

Permalink
Add overload to handle unknown returned by TS-4.4 for errors be defau…
Browse files Browse the repository at this point in the history
…lt (#1116)
  • Loading branch information
kibertoad authored Sep 4, 2021
1 parent 71a537c commit a201e2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"homepage": "http://getpino.io",
"devDependencies": {
"@types/node": "^16.7.2",
"@types/node": "^16.7.10",
"airtap": "4.0.3",
"benchmark": "^2.1.4",
"bole": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions pino.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ declare namespace P {
interface LogFn {
/* tslint:disable:no-unnecessary-generics */
<T extends object>(obj: T, msg?: string, ...args: any[]): void;
(obj: unknown, msg?: string, ...args: any[]): void;
(msg: string, ...args: any[]): void;
}

Expand Down
6 changes: 6 additions & 0 deletions test/types/pino.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ pino({ name: "my-logger" }, destinationViaStream);
pino(destinationViaOptionsObject);
pino({ name: "my-logger" }, destinationViaOptionsObject);

try {
throw new Error('Some error')
} catch (err) {
log.error(err)
}

interface StrictShape {
activity: string;
err?: unknown;
Expand Down

0 comments on commit a201e2c

Please sign in to comment.