Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 679 Bytes

File metadata and controls

27 lines (18 loc) · 679 Bytes

Home > types-kit > IsPrimitive

IsPrimitive type

If T is a primitive value, return true, else return false.

Signature:

export type IsPrimitive<T> = IfExtends<
  [T, never],
  false,
  IfExtends<[T, Primitive], IfExtends<[IsAny<T>, true], false, true>, false>
>

References: IfExtends, Primitive, IsAny

Example

// Expect: true
type Foo = IsPrimitive<boolean>