UNPKG

type-tls

Version:

type-tls 封装了与类型相关的工具,比如:获取数据的类型 或 类型名字、判断数据的类型 等

35 lines (24 loc) 1.27 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [type-tls](./type-tls.md) &gt; [ExactType](./type-tls.exacttype.md) ## ExactType type 精确类型 **Signature:** ```typescript export type ExactType = LooseType | Exclude<TypeOfReturnType, "undefined" | "function" | "object">; ``` **References:** [LooseType](./type-tls.loosetype.md)<!-- -->, [TypeOfReturnType](./type-tls.typeofreturntype.md) ## Remarks 在精准类型中认为 JavaScript 的原始类型(非对象类型) 与 其对应的 包装类型(类类型)是不同的类型,即: number 和 Number、string 和 String、booleanBoolean 等 是不同的类型; 对于原始类型,返回的结果 会与 typeof 返回的结果一样; 但,对于 undefined 和 null 会返回其自身值(即 undefined 和 null)作为类型值 各种类型的值 与 该方法的返回值 的映射如下: ``` undefined :undefined null : null string : "string" number : "number" bigint : "bigint" boolean : "boolean" symbol : "symbol" function : Function 没有原型的对象(如:通过 `Object.create(null)` 创建的对象) : "object" 其它任何类型的实例 : 返回该实例的构造函数 ```