Visitar URL original
Allow URL class object as an argument for fetch() by Maxim-Mazurok · Pull Request #1696 · node-fetch/node-fetch · GitHub
Skip to content

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

Merged
jimmywarting merged 2 commits into
node-fetch:mainfrom
Maxim-Mazurok:fetch-url
Jan 9, 2023
Merged

jimmywarting merged 2 commits into
node-fetch:mainfrom
Maxim-Mazurok:fetch-url

Conversation

@Maxim-Mazurok

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

Copy link
Copy Markdown
Contributor

@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
Comment thread @types/index.d.ts Resolved

@LinusU LinusU left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@Maxim-Mazurok

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Looking forward to having this published on npm, thanks!

@Maxim-Mazurok

Copy link
Copy Markdown
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
Copy Markdown
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

Maxim-Mazurok commented Feb 19, 2023 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown

🎉 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