Tag: fetch-api

typescript Cannot add headers to a fetch api using react-native

问题内容: I am using Fetch API from react-native and I am using typescript. My code looks like this: let responseLogin = await fetch('http://url_example', { method: 'POST', headers: {'Content-Type':'application/json'}, body: requestBody }); But I get the following error where the header is: Argument of type '{ method: string; headers: { 'Content-Type': string; }; body: string; }'