Skip to content

ref: Fix TypeScript type warning regarding catch - #288

Merged
BYK merged 1 commit into
masterfrom
byk/ref/ts-catch
Sep 15, 2021
Merged

ref: Fix TypeScript type warning regarding catch#288
BYK merged 1 commit into
masterfrom
byk/ref/ts-catch

Conversation

@BYK

@BYK BYK commented Sep 15, 2021

Copy link
Copy Markdown
Member

TypeScript now defaults to unknown for caught error types instead of any causing us to get warnings when trying to access some standard Error properties. This PR changes the code accordingly so it is both safer, cleaner, and does not have this warning anymore.

@iker-barriocanal iker-barriocanal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to set either --strict or --useUnknownInCatchVariables? See https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables

@BYK
BYK enabled auto-merge (squash) September 15, 2021 13:09
@BYK
BYK merged commit 3aac2b9 into master Sep 15, 2021
@BYK
BYK deleted the byk/ref/ts-catch branch September 15, 2021 13:10
@BYK

BYK commented Sep 15, 2021

Copy link
Copy Markdown
Member Author

Don't we need to set either --strict or --useUnknownInCatchVariables? See https://typescriptlang.org/tsconfig#useUnknownInCatchVariables

Seems like this became the default since TS 4.4. Not sure what I'm getting but this doesn't break anything and also makes our code future-proof so I'd just land 馃榾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants