Use nhost.functions.call to call (sending a POST request to) a serverless function. Use generic
types to specify the expected response data, request body and error message.
type Data = { message: string}type Body = { email: string name: string}type ErrorMessage = { details: string}// The function will only accept a body of type `Body`const { res, error } = await nhost.functions.call<Data, Body, ErrorMessage>( 'send-welcome-email', { email: 'joe@example.com', name: 'Joe Doe' })// Now the response data is typed as `Data`console.log(res?.data.message)// Now the error message is typed as `ErrorMessage`console.log(error?.message.details)