更新时间:2023-11-10 15:54:10
我认为没有直接的方法来指定一个数字是整数还是浮点数.在 TypeScript 规范第 3.2.1 节中我们可以看到:
I think there is not a direct way to specify whether a number is integer or floating point. In the TypeScript specification section 3.2.1 we can see:
...Number 基元类型对应于类似命名的 JavaScript 基元类型,表示双精度 64 位格式 IEEE 754 浮点值..."
"...The Number primitive type corresponds to the similarly named JavaScript primitive type and represents double-precision 64-bit format IEEE 754 floating point values..."
我认为 int
是 Visual Studio 智能感知中的一个错误.正确的是number
.
I think int
is a bug in Visual Studio intelliSense. The correct is number
.