Type.Is

语法

Type.Is(type1 as type, type2 as type) as logical

关于

确定 type1 的值是否始终与 type2兼容。 参数 type2 应为基元(或可为空的基元)类型值。 否则,此函数的行为是未定义的,不应依赖。

示例 1

确定 number 类型的值是否总是可以被视为类型 any。

使用情况

Type.Is(type number, type any)

输出

true

示例 2

确定任何类型的值是否始终可被视为类型编号。

使用情况

Type.Is(type any, type number)

输出

false