const 变量声明是类型定义吗

Is const variable declaration a type definition

下面const变量声明(Point),

const Point = {
        x: 1,
        y: 2
}

Point.z = 6 说,Property 'z' does not exist on type '{ x: number; y: number; }'

const变量声明是类型定义吗?

没有。 TypeScript 正在根据您设置的 Point 变量来推断类型。 const 正在对其进行设置,以便您无法重新分配 Point 变量。您将在代码中使用 varlet 看到相同的行为。