const greeting:string="abc" 为什么会报错

第一次使用TS。一个很简单的语句就报错,就是给常量加了个类型。
string及 {x:number,y:number}及{x:number}都会报错的

const greeting:string="abc";
const temp:{x:number,y:number}={x:5,y:6};
console.log(temp);
//@ts-ignore
const point:{x:number}={x:88};
console.log(point);

报错信息:
C:\Program Files\nodejs\node.exe .\hello-world.ts
Process exited with code 1
Uncaught SyntaxError d:\VUE-test\typescript_tt\hello-world.ts:1
const greeting:string="abc";
^

SyntaxError: Missing initializer in const declaration
at compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Module._load (node:internal/modules/cjs/loader:822:12)
at executeUserEntryPoint (node:internal/modules/run_main:77:12)
at (node:internal/main/run_main_module:17:47)
没有可用的调试程序,无法发送“variables”

用的工具是VS-CODE

谢谢各位了。TS不能直接运行,先进行编译成js后才能运行。不是像其他语言那样,直接运行。

let greeting:string="abc";
改一下

ts编译器装了吗

是否初始化了tsconfig.js

node指令不能直接编译ts文件,需要转义为js