Skip to content

Typings — Array

TypeScript interface and type alias exported from @litert/utils-array.

Import

ts
import type { IDeduplicateFn } from '@litert/utils-array';

Interface IDeduplicateFn

Source: Deduplicate.ts

The overloaded function interface type for the deduplicate export. It expresses both call signatures: one for arrays of basic types (where makeKey is optional) and one for arrays of complex/object types (where makeKey is required or explicitly null).

Definition

ts
interface IDeduplicateFn {
    // Overload 1 — basic types
    <T extends IBasicType>(items: readonly T[], makeKey?: (v: T) => any): T[];

    // Overload 2 — complex/object types
    <T extends IAdvancedType>(items: readonly T[], makeKey: null | ((v: T) => any)): T[];
}

This interface is the runtime type of the deduplicate export. You can use it when declaring function parameters that accept deduplicate-compatible callables.