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

Fix request types for use with Node #578

Merged

Commits on Apr 20, 2024

  1. Fix request types for use with Node

    When using Ky with Node, TypeScript will run into compilation error regarding types required by `UndiciRequestInit`. This is because `@types/node` does not yet provide these types, and they are not imported from `undici-types` either. The latter would not even be possible to keep Ky usable with browsers.
    
    This happened to work in the project, because `@sindresorhus/tsconfig` includes `DOM` in the libs section. In most Node applications, the DOM lib should not be there and clashes with Node types. One way to circumvent this is to add `skipLibCheck: true` to `tsconfig.json`, but this is not a good solution.
    
    This commit adds the needed types until `@types/node` imports the missing types and adds them to globals. After that, all "Undici" types from the request types should be removed.
    jliuhtonen committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    868ba34 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2024

  1. Add comment about Undici request types

    Add link to DefinitelyTyped issue with missing exported globals.
    jliuhtonen committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    733c34a View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2024

  1. Update request.ts

    sindresorhus committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    ebfc6f4 View commit details
    Browse the repository at this point in the history