correct types for this function?

How would you correctly type getTokenIds()?
export const getTokens = async () => {
  return await supabase.from('tokens').select('*')
}
export const getTokenIds = tokens => {
  return tokens.data!.map(token => token.coingecko_id).filter(id => id != null)
}


getTokens() returns
{
  error: null,
  data: [{some data}, {some data}]
}

would be used in this context
const tokens = await getTokens()
const ids = getTokenIds(tokens)
Was this page helpful?