primitive

Syntax

type primitive

Represents a primitive.

Example

import { primitive } from 'potence';

let value: primitive = 'foo';   // okay
value = 5;    // okay
value = {};   // error

Remarks

There are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol. See MDN for more information.

The reason this type is not capitalized is a stylistic choice to maintain consistency with actual primitive types, whose types are also uncapitalized (think: string or number).

There is a type guard available for this type: see isPrimitive().