Type alias If_PlainObject<T>

If_PlainObject<T>: T extends object
    ? T extends any[] | Function | Date | RegExp | Map<any, any> | Set<any>
        ? false
        : true
    : false

传入一个类型判断该类型是否是普通对象(多数用于判断字面量对象),如果是返回 true 否则返回 false

Type Parameters

  • T

Example

If_PlainObject<{a: string}> // true
if_PlainObject<() => string> // false

Generated using TypeDoc