Skip to main content

Primitive

@ts-rust/std


@ts-rust/std / Types / Primitive

Type Alias: Primitive

type Primitive = boolean | string | number | bigint | symbol | null | undefined;

Defined in: packages/std/src/types.ts:169

Represents all JavaScript primitive types.

A primitive is any value that is not an object and has no methods. Primitives are immutable (except for symbol properties) and are compared by value, not by reference.

The Primitive type includes:

  • boolean
  • string
  • number
  • bigint
  • symbol
  • null
  • undefined

Objects, arrays, functions, and other reference types are not primitives. Use this type to enforce that a value belongs to one of these fundamental types.