I created "test.ts" in VSCode like this:
var data ="https://a.b.c/d/e/f";
var url = new URL(data);
console.log(url.protocol);
and when I press F5 outputs "https:". But If I add the type like
var url:URL = new URL(data);
and press F5, the output is:
Process exited with code 1
C:\Program Files\nodejs\node.exe .\test.ts
Uncaught c:\[path]\test.ts:2
var url:URL = new URL(data);
^
SyntaxError: Unexpected token ':'
No debugger available, can not send 'variables'
What is wrong? If I search for the syntax, I can see an example like:
