えぐろぐ

https://twitter.com/eggpogg

TypeScriptsでnew URL をする時のエラー

以下のように書いていたら

import * as url from "url"
const url = new url.URL("https://google.com")

以下のエラーがコンソールに出力された

TypeError: undefined is not a constructor (evaluating 'new url__WEBPACK_IMPORTED_MODULE_9__["URL"]

調べてみると、lib.dom.d.ts に処理が追加されたとのことなので 
github.com

importは不要で以下だけで良かったみたい。

const url = new URL("https://google.com")