fetch's Response.text also returns a Promise, so you'd have to await twice:
const lines = (await (await fetch(myUrl)).text()).split('\n'); const lines = (await (await fetch(myUrl)).text()).split('\n'); function fetchText(input?: string | Request, init?: RequestInit) {
return fetch(input, init).then(x => x.text())
}
function fetchJson(input?: string | Request, init?: RequestInit) {
return fetch(input, init).then(x => x.json())
}