question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

type RequestInfo should include URL

See original GitHub issue

Currently 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:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aslilaccommented, Aug 27, 2021

Yeah, it feels like { toString(): string } falls into the same pit as {} in that almost anything could be cast to it.

0reactions
dnalborczykcommented, Oct 19, 2021
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found