Hi. for handing errors in typescript, is there any...
# support-questions-legacy
m
Hi. for handing errors in typescript, is there any way to not have error in the catch block as an any type?
Copy code
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
  if (e.isSuperTokensGeneralError) {
    ...
r
hey @maxrm13 yea You can try something like:
Copy code
import { Error as SuperTokensError } from "supertokens-node";

try {
  ....
} catch (err: Error) {
  if (SuperTokensError.isErrorFromSuperTokens(err)) {
    //..
   }
}
m
Awesome thanks! TS wasn't letting me type err as Error so I went with this
Copy code
catch (e: unknown) {
  if (e instanceof Error && SuperTokensError.isErrorFromSuperTokens(e)) {
    console.log('st error');
r
Right.
2 Views