I get an error with TypeScript react after running, while on other devices it can, only on my mac

222 views Asked by At

I get an error with typescript after running, while on other devices it can, only on my mac. Am I missing something or the version difference? I'm so confused please help me

Failed to compile

/Users/tq-web/src/hooks/useRequest/useRequest.ts
TypeScript error in /Users/tq-web/src/hooks/useRequest/useRequest.ts(24,47):
Type 'unknown' is not assignable to type 'null'.  TS2322

    22 |       setState({ status: RequestStatus.COMPLETED, error: null, data })
    23 |     } catch (error) {
  > 24 |       setState({ status: RequestStatus.ERROR, error: error, data: null })
       |                                               ^
    25 |     }
    26 |   }
    27 |
0

There are 0 answers