Skip to main content
Module

x/unknownutil/mod.ts>isPrimitive

🦕 A lightweight utility pack for handling unknown type
Go to Latest
function isPrimitive
import { isPrimitive } from "https://deno.land/x/unknownutil@v3.18.0/mod.ts";

Return true if the type of x is Primitive.

import { is, Primitive } from "@core/unknownutil";

const a: unknown = 0;
if (is.Primitive(a)) {
  // a is narrowed to Primitive
  const _: Primitive = a;
}

Parameters

x: unknown