Isomorphic-fetch Typescript setup
Author: Coruscate5Created Mar 26, 2021Updated Aug 30, 2021
After installing the types and isomorphic-fetch from npm, I get the following error in Typescript:
TS2349: (TS) This expression is not callable.
Type '{ default: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>; }' has no call signatures.In my Saga, I simply call fetch normally:
yield fetch(someInterpolatedApiCall);
Forgive me, I've read as much as I can without giving myself an aneurysm - I'm having difficulty understanding what the fix normally is for Typescript. I import the lib using "import * as fetch from 'isomorphic-fetch'". As far as I can tell, the error may be valid because of default-importing, but I don't know what I need to do to satisfy TS. The call does work, but I'm trying to remove the persistent error.
Source: matthew-andrews/isomorphic-fetch