Function lacks ending return statement and return type does not include ‘undefined’

The best solution would be to throw an error on the catch, instead of undefining the return type. The undefined type removes the whole point of using TypeScript otherwise.

Try this:

export const getMarkets = async (): Promise<IGetMarketsRes> => {
  try {
     // Your code :)
  } catch (err) {
    // Throw error
    throw(err)
  }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)