Skip to content

Isomorphic-fetch Typescript setup #196

@Coruscate5

Description

@Coruscate5

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions