Skip to main content
Module

x/fun/record.ts>NonEmptyRecord

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
type alias NonEmptyRecord
import { type NonEmptyRecord } from "https://deno.land/x/fun@v2.0.0/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.

Examples

Example 1

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
definition: keyof R extends never ? never : R