Skip to content

Commit

Permalink
fix: remove reliance on instanceof & use duck-typing instead
Browse files Browse the repository at this point in the history
This should make interoperability easier
  • Loading branch information
jdpnielsen committed Sep 14, 2020
1 parent 74ae474 commit a37badf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/cerror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export class CError extends Error {
}

public static cause(err: CError | Error): CError | Error | null {
if (err instanceof CError && err.cause) {
return err.cause;
if ((err as CError).cause) {
return (err as CError).cause as CError | Error;
} else {
return null;
}
Expand Down

0 comments on commit a37badf

Please sign in to comment.