isomorphic-fetch icon indicating copy to clipboard operation
isomorphic-fetch copied to clipboard

Isomorphic-fetch Typescript setup

Open Coruscate5 opened this issue 4 years ago • 2 comments

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.

Coruscate5 avatar Mar 26 '21 13:03 Coruscate5

Gave it a shot - I've abandoned using isomorphic-fetch for the time being

Coruscate5 avatar Apr 16 '21 14:04 Coruscate5

What do you use instead?

simPod avatar Aug 30 '21 10:08 simPod