Skip to content

index.d.ts incorrectly suggests there is a default export #96

Description

@BrendanC23

The TypeScript types for this library (https://github.com/jonbern/fetch-retry/blob/master/index.d.ts) indicate that there is a default export.

fetch-retry/index.d.ts

Lines 25 to 28 in 8684ef4

export default function fetchBuilder<F extends FetchLibrary>(
fetch: F,
defaults?: RequestInitRetryParams<F>,
): (input: Parameters<F>[0], init?: RequestInitWithRetry<F>) => ReturnType<F>;

The README says that proper usage of this library is like

const originalFetch = require('isomorphic-fetch');
const fetch = require('fetch-retry')(originalFetch);

This code is correct and works fine. However, the TypeScript types suggest that the following is necessary, even though the it does not work and there is no default value.

const originalFetch = require('isomorphic-fetch');
const fetchRetry = require('fetch-retry');
const fetch = fetchRetry.default(originalFetch);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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