sindresorhus / got

🌐 Human-friendly and powerful HTTP request library for Node.js
MIT License
14.27k stars 935 forks source link

Wrong type for retry option #2272

Closed Cluster2a closed 1 year ago

Cluster2a commented 1 year ago

Describe the bug

Actual behavior

According to the index.d.ts the GotOptions accept a number or a RetryOptions for the retry attribute. Passing the attribute leads to an exception: RequestError: Unexpected retry option: retries

Expected behavior

Passing the retry parameter as in the code below would not lead to an exception. Both ways fail, but should be good, according to @types/got.

Code to reproduce

const response = await got(server.config.MINIO_HOST, {
    timeout: {
        lookup: 100,
        connect: 50,
        secureConnect: 50,
        socket: 1000,
        send: 10000,
        response: 1000
    },
    retry: {
        retries: 5
    }
});
const response = await got(server.config.MINIO_HOST, {
    timeout: {
        lookup: 100,
        connect: 50,
        secureConnect: 50,
        socket: 1000,
        send: 10000,
        response: 1000
    },
    retry: 5
});

Checklist

sindresorhus commented 1 year ago

Got ships with its own types. @types/got are outdated.