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

Allow URL class object as an argument for fetch() #1696

Merged
merged 2 commits into from Jan 9, 2023

Conversation

Maxim-Mazurok
Copy link
Contributor

@Maxim-Mazurok Maxim-Mazurok commented Jan 5, 2023

@Maxim-Mazurok Maxim-Mazurok changed the title allow to fetch URL Allow to fetch URL Jan 5, 2023
@Maxim-Mazurok Maxim-Mazurok changed the title Allow to fetch URL Allow URL class object as an argument for fetch() Jan 5, 2023
@types/index.d.ts Outdated Show resolved Hide resolved
Copy link
Member

@LinusU LinusU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Maxim-Mazurok
Copy link
Contributor Author

CI fails for reasons unrelated to the change, it fails with the same errors on the main branch as well.
Following advice from #1657 (comment) adding tsconfig.json with the following contents:

{
	"compilerOptions": {
		"lib": ["DOM"]
	}
}

resolves the issue, however, I'm not sure if that's the correct way to do it.

If it was up to me - I'd force-merge this PR and address the FormData issues separately:

npm run test-types

> node-fetch@3.1.1 test-types
> tsd


  node_modules/formdata-polyfill/esm.min.d.ts:2:10
  ✖    2:10  FormData refers to a value, but is being used as a type here. Did you mean typeof FormData?  
  ✖    3:13  FormData refers to a value, but is being used as a type here. Did you mean typeof FormData?  
  ✖    5:49  FormData refers to a value, but is being used as a type here. Did you mean typeof FormData?  

  @types/index.d.ts:124:3
  ✖  124:3   FormData refers to a value, but is being used as a type here. Did you mean typeof FormData?  
  ✖  137:21  FormData refers to a value, but is being used as a type here. Did you mean typeof FormData?  

  node_modules/fetch-blob/from.d.ts:20:63
  ✖   20:63  File refers to a value, but is being used as a type here. Did you mean typeof File?          
  ✖   25:59  File refers to a value, but is being used as a type here. Did you mean typeof File?          

  node_modules/fetch-blob/file.d.ts:1:75
  ✖    1:75  Element implicitly has an any type because type typeof globalThis has no index signature.    

  8 errors

But happy to add the above mentioned fix if that sounds like a good idea?

@jimmywarting jimmywarting merged commit e093030 into node-fetch:main Jan 9, 2023
@Maxim-Mazurok Maxim-Mazurok deleted the fetch-url branch January 15, 2023 02:18
@Maxim-Mazurok
Copy link
Contributor Author

Looking forward to having this published on npm, thanks!

@Maxim-Mazurok
Copy link
Contributor Author

@jimmywarting, I'm not familiar with the release cycle of this library, but I'm still waiting for this to be published in v3, thank you!

@jimmywarting
Copy link
Collaborator

Kind of release a new version every time a PR with the commit fix: or feat: is merged. docs and d.ts is rarely never released

@Maxim-Mazurok
Copy link
Contributor Author

Maxim-Mazurok commented Feb 19, 2023

Ah, I wasn't aware of that... This probably should've been a fix:...
Perhaps adding commitizen or some pre-commit hook to validate commit messages would help new contributors?
I've created a dummy PR with fix: to trigger release now: #1716

@github-actions
Copy link

🎉 This PR is included in version 3.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

URL is missing in typescript definitions for RequestInfo
3 participants