type RequestInfo should include URL
See original GitHub issueCurrently RequestInfo
is Request | string
, but should (minimally) be Request | URL | string
.
fetch(new URL('/some_api', 'https://example.com'))
is valid, and works as you’d expect.
Technically it should be Request | { toString(): string } | string
according to MDN, but I’m not sure if there are intricacies around that.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Argument type URL is not assignable to parameter type string
If you want to keep using the type URL for some reasons, you can do the following: give this.urlDevices.toString() as the first parameter...
Read more >Request.url - Web APIs | MDN
The url read-only property of the Request interface contains the URL of the request. Value. A string indicating the URL of the request....
Read more >fetch documentation
This documents the polyfillable parts of the WHATWG Fetch standard. See Caveats for notable exceptions. Usage synopsis (use the argument links to find...
Read more >HttpRequest Class (System.Web) | Microsoft Learn
You can write Request["key"] . The first example shows how to retrieve a query string value when loading a page. C# Copy.
Read more >How to Use fetch with TypeScript -- newline - Fullstack.io
to specify the return data type: function request<TResponse>( url: string, // `RequestInit` is a type for configuring // a `fetch` request.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, it feels like
{ toString(): string }
falls into the same pit as{}
in that almost anything could be cast to it.as well as: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/600
fetch
falls pretty much into the same category.similar: https://github.com/microsoft/TypeScript/issues/43066