3.0.6 (2025-12-12)
🐛 Bug fix(es)
- Add Self to return type (e5582d6)
import wretch from "wretch";
import AbortAddon from "wretch/addons/abort";
const base = wretch()
.addon(AbortAddon())
.catcher(404, (error) => { throw error; });
// Previously: ❌ TypeScript error: Property 'signal' does not exist
// Now: 🟢
base.signal(new AbortController()).get("/test");import wretch from "wretch";
class ApiError extends Error {
constructor(public status: number, message: string) {
super(message);
}
}
const api = wretch()
.customError(async (error) => {
return new ApiError(error.status, error.message);
})
.catcherFallback((error) => {
// Previously 🔴
// Error was typed as "ApiError"
// But if you block the URL in Chrome DevTools (or network is down):
// `error` is actually `TypeError: Failed to fetch`
//
// Now: 🟢
// error is properly typed as "unknown"
console.log(error);
});