Skip to main content
Module

x/unknownutil/mod.ts>isRecord

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

Return true if the type of x is Record<PropertyKey, unknown>.

import { is } from "https://deno.land/x/unknownutil@v3.16.1/mod.ts";

const a: unknown = {"a": 0, "b": 1};
if (is.Record(a)) {
  // a is narrowed to Record<PropertyKey, unknown>
  const _: Record<PropertyKey, unknown> = a;
}

Parameters

x: unknown

Returns

x is Record<PropertyKey, unknown>