sindresorhus / got

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

Unable to resolve some types in v11 #1166

Closed pqvst closed 4 years ago

pqvst commented 4 years ago

Describe the bug

According to the documentation, got should export a type called GotRequestMethod. However I am unable to import that type in v11.

Furthermore, I am unable to import the Agents type for the updated agent option in v11: https://github.com/sindresorhus/got/releases/tag/v11.0.0

Actual behavior

TSError: ⨯ Unable to compile TypeScript:
foo.ts:1:15 - error TS2614: Module '"../../../../Users/philip/Desktop/tsgottest/node_modules/got/dist/source"' has no exported member 'GotRequestMethod'. Did you mean to use 'import GotRequestMethod from "../../../../Users/philip/Desktop/tsgottest/node_modules/got/dist/source"' instead?

1 import got, { GotRequestMethod, Agents } from 'got';
                ~~~~~~~~~~~~~~~~
foo.ts:1:33 - error TS2614: Module '"../../../../Users/philip/Desktop/tsgottest/node_modules/got/dist/source"' has no exported member 'Agents'. Did you mean to use 'import Agents from "../../../../Users/philip/Desktop/tsgottest/node_modules/got/dist/source"' instead?

1 import got, { GotRequestMethod, Agents } from 'got';
                                  ~~~~~~

Expected behavior

I expect these types to be available.

Code to reproduce

import got, { GotRequestMethod, Agents } from 'got';
function req(method: GotRequestMethod, agent: Agents) {
  got({ method, agent });
}

Checklist

szmarczak commented 4 years ago

GotRequestMethod has been renamed to GotRequestFunction (see the changelog). The Agents example is a regression, it should be available.