Closed govindrai closed 2 years ago
URL
is available as a global if that helps, you don't need to require('node:url')
:
$ node
Welcome to Node.js v18.9.0.
Type ".help" for more information.
> const myUrl = new URL("https://abc.com?queryParam=a&otherQueryParam=b")
undefined
> myUrl
URL { … }
> typeof myUrl
'object'
I'm not sure what can be done here, url.Url
cannot be removed as it could break the ecosystem. I suggest we close this as "Won't fix" for now, but let me know if you see a way to improve the situation (or feel free to ask more questions if you have any).
Version
v17.3.0
Platform
Darwin GRai-M-T576V 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 x86_64
Subsystem
No response
What steps will reproduce the bug?
Head into the node repl
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
I expect
url.Url()
to not be an available method since it'd not in the documentation and produces a TS error when trying to use it in an editor such as VS CodeWhat do you see instead?
Additional information
This is a bit pernicious because I spent a while trying to figure out why my url wasn't returning anything even though it seemed as if I was apparently following node tutorials properly, not seeing the incorrect case (I needed to use
url.URL
vsurl.Url
).