Skip to content

Type error with node-fetch #64

@suzil

Description

@suzil

Code:

import fetchRetry from 'fetch-retry';
import originalFetch from 'node-fetch';

const fetch = fetchRetry(originalFetch);

TypeScript error:

TSError: ⨯ Unable to compile TypeScript:
test.ts:4:26 - error TS2345: Argument of type '(url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>' is not assignable to parameter of type '(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>'.
  Types of parameters 'url' and 'input' are incompatible.
    Type 'RequestInfo' is not assignable to type 'import("/Users/suzil/Documents/ownup/test/node_modules/node-fetch/@types/index").RequestInfo'.
      Type 'Request' is not assignable to type 'RequestInfo'.
        Type 'Request' is missing the following properties from type 'Request': size, buffer

4 const fetch = fetchRetry(originalFetch);

Using latest versions of both libraries:

"dependencies": {
  "fetch-retry": "^5.0.1",
  "node-fetch": "^3.0.0"
}

Repo here: https://github.com/suzil/fetch-retry-type-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