Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve types with generic extend #2353

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

spence-s
Copy link
Contributor

@spence-s spence-s commented May 29, 2024

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates in both the README and the types.

This changes the way types work in Got by making got a generic function of the passed in options.

Fixes #1117 and opens up to some new generic patterns that may make the TS experience better. It doesn't look like there are any specific tests for types, but this was light enough change that it didn't take any code changes.

There shouldn't be really any "breaking" changed here, the types work a little different, but that shouldn't be noticeable to most I don't think.

@sindresorhus
Copy link
Owner

It would be useful with some kind of type test that proves that this change actually works. Could just do some https://github.com/mmkal/expect-type assertions in one of the test files.

@sindresorhus sindresorhus merged commit 15ca4a0 into sindresorhus:main Jun 4, 2024
1 check passed
@sindresorhus
Copy link
Owner

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to correctly type an instance returned by got.extend
2 participants