Number one this week, Gretchen is a HTTP client for the browser built on top of fetch
API.
The main difference with similar solutions like Ky or Fetch-Retry is the error handling and the TypeScript support, as it aims to be a “type-safe fetch”.
It does not throw errors but returns either a data
object or an error
object, for error code statuses.
Let’s see how an example of code looks like:
type UserType = {
name: string;
};
type ErrorType = {
messages: string[];
};
const { error, data } = await gretch<UserType, ErrorType>(
"/user/12345"
).json();
if (error) {
// error is typeof ErrorType
} else if (data) {
// data is typeof UserType
}
It’s an interesting option when you know the shape your errors will have.
Growing Fast This Week
By % of GitHub stars added (relative growth) this week
1 | Gretchen Making fetch happen in TypeScript. | GitHub | +78.9% | |
2 | Seafox A blazing fast 100% spec compliant, self-hosted javascript parser | GitHub | +51.6% | |
3 | heapify The fastest JavaScript priority queue out there. Zero dependencies. | GitHub | +46.0% | |
4 | Uppload Uppload is a better JavaScript image uploader with 30+ plugins | Homepage | +19.7% | |
5 | TestCheck.js Generative testing for JavaScript | Homepage | +13.0% | |
6 | Zod TypeScript-first schema validation with static type inference | GitHub | +10.1% | |
7 | uPlot A small, fast chart for time series, lines, areas, ohlc & bars | GitHub | +9.6% | |
8 | React Query Hooks for fetching, caching and updating asynchronous data in React | GitHub | +7.6% | |
9 | Redwood Bringing full-stack to the JAMstack. | Homepage | +6.9% | |
10 | G2Plot An interactive and responsive charting library | Homepage | +6.6% |
Trending This Week
By number of GitHub stars added this week
1 | Papers we love Papers from the computer science community to read and discuss. | Homepage | +884 ★ | |
2 | Vue.js A progressive, incrementally-adoptable framework for building UI on the web | Homepage | +460 ★ | |
3 | Vue Element Admin A magical vue admin | GitHub | +414 ★ | |
4 | React Query Hooks for fetching, caching and updating asynchronous data in React | GitHub | +373 ★ | |
5 | VS Code Visual Studio Code | Homepage | +363 ★ | |
6 | React A declarative, efficient, and flexible JavaScript library for building UI | Homepage | +347 ★ | |
7 | Rome An experimental JavaScript toolchain | Homepage | +335 ★ | |
8 | Node.js Best Practices The Node.js best practices list | GitHub | +312 ★ | |
9 | JS Algorithms & Data Structures Algorithms and data structures implemented in JavaScript with explanations | GitHub | +301 ★ | |
10 | Axios Promise based HTTP client for the browser and node.js | GitHub | +262 ★ |
Any question or feedback? Reach us on GitHub.
Best of JavaScript is a project created by Michael Rambeau, made in Osaka, Japan.