Conversation
|
Code Climate has analyzed commit 05bee21 and detected 12 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
+1 for approach 2 |
|
I think we should move forward w approach 2 |
|
i feel like it'd almost be easier to make a new PR and change all the errors rather than try to tackle those merge conflicts? maybe if no one wants to resolve all those conflicts, we put this in an issue and close this? |
@3xtr4t3rr3str14l I just did a search and replace of |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions. |
|
Closing for #3072 |
The
earg in} catch (e) {is typed asanyeffectively ts-ignoring all downstream code that consumes it. Typescript 4.0 allows to type theeas unknown microsoft/TypeScript#39015 which is practically the correct type.Approach 1: no types at all
Approach 2: cast e to Error
If
handleErrorsignature changes you will be alertedApproach 3: check for Error
Probably overkill since the likelyhood of an external library throwing a non-Error instance is extremely low
eslint rule no-implicit-any-catch will enforce this pattern
This PR is meant to gauge interest from Lodestar contributors to adopt this type strategy with errors, before actually doing all the changes necessary. I've just bumped prettier to 2.1 to support type annotations on catch clauses and run a find and replaces