https://github.com/posva/mande 800 байт враппера вокруг нативного fetch. Меняет вот это: // creating a new user fetch('/api/users', { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'Dio', password: 'irejectmyhumanityjojo', }), }) .then((response) => { if (response.status >= 200 && response.status < 300) { return response.json() } // reject if the response is not 2xx throw new Error(response.statusText) }) .then((user) => { // ... }) На вот это: const users = mande('/api/users')

users .post({ name: 'Dio', password: 'irejectmyhumanityjojo', }) .then((user) => { // ... })

Совместим с ts: const todos = mande('/api/todos', globalOptions)

todos.get<{ text: string; id: number; isFinished: boolean }[]>().then((todos) => { // todos is correctly typed })