Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

NonEmptyRecord

import type { NonEmptyRecord } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/record.ts";

NonEmptyRecord is a bounding type that will return a type level never if the type value of R is either not a record is a record without any index or key values.

@example
import type { NonEmptyRecord } from "./record.ts";

function doSomething<R>(_: NonEmptyRecord<R>): void {
  return undefined;
}

const result = doSomething({ one: 1 }); // This is ok
// const result2 = doSomethign({}); // This is a type error
type NonEmptyRecord<R> = keyof R extends never ? never : R;

§Type Parameters

§Type

§
keyof R extends never ? never : R
[src]