You also need to have zod installed for schema validations. If you don't plan to use zod for schema validation, you can install it as a dev dependency.
The fastest way to start using better fetch is to import the betterFetch function and start making requests.
You can define the response type using generics or zod schema (recommended).
Make sure strict mode is enabled in your tsconfig when using zod schema validations.
Better fetch by default returns a Promise that resolves to an object of data and error but if you pass the throw option, it will return the parsed response data only.
You can throw errors instead of returning them by passing the throw option.
If you pass the throw option, the betterFetch function will throw an error. And instead of returning data and error object it'll only the response data as it is.