I’m getting this warning, but what is supposed to ...
# sst
a
I’m getting this warning, but what is supposed to be the type on those
catch
? Looks like has to be
any
or
unknown
but the linter doesn’t allow it.
Copy code
71:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
r
Type it as unknown i.e.
catch(err: unknown)
Then either use a type guard
Copy code
if(err instanceof BaseError) {
  // do stuff
}
or cast it
Copy code
const error = err as BaseError
a
Ah, yeah, so I should type is as unknown to avoid any?
r
Yeah
a
Cool thanks!
r
No worries 😄
f
Really envy ppl who knows their TS stuff 🤒