javascript - Browser API: URL class is not recognized in Typescript -


i'm using url utility: https://developer.mozilla.org/en-us/docs/web/api/url , have problem using in typescript code.

whereas can open console in browser , type:

new url("http://stackoverflow.com/question/ask") 

and code successful, whenever write in typescript file , transpile it, following error:

error ts2351: cannot use 'new' expression type lacks call or construct signature.

does mean class doesn't exist in typescript? there way use in typescript code?

that should supported typescript, that's included on lib.dom.d.ts included default if target es5.

you can configure on tsconfig.json (that default config when using es5, can try add explicitly):

"lib": [             "dom",             "es5",             "scripthost"         ], 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -