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: Allow URL as input on fetch() on TypeScript typings for compat with Node.js #707

Merged
merged 1 commit into from Nov 26, 2023

Conversation

harmony7
Copy link
Contributor

@harmony7 harmony7 commented Nov 23, 2023

This PR adds URL as an allowed type for the first parameter of the fetch() function in the TypeScript type definitions.

The parameter is listed in MDN to be anything that is a string or has a stringier, including URL.
The functionality seems to already be there in the runtime.
Node.js's typings has RequestInfo | URL.

Currently if you write a program that happens to load both typings and there isn't a way around it, then if you pass a URL to the fetch() function, it will think you're calling Node.js's fetch and not ours, so this would be a usability fix.

@JakeChampion JakeChampion changed the title Allow URL as input on fetch() on TypeScript typings for compat with Node.js fix: Allow URL as input on fetch() on TypeScript typings for compat with Node.js Nov 24, 2023
@harmony7 harmony7 merged commit 4f39943 into main Nov 26, 2023
14 checks passed
@harmony7 harmony7 deleted the kats/fetch-input-type branch November 26, 2023 05:24
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.

None yet

2 participants