UNPKG

@cuppachino/type-space

Version:

A collection of type utilities for TypeScript.

11 lines (10 loc) 254 B
import type { UnknownArray } from './index.js'; /** * Extracts the length property from an array or tuple. * ``` * @example Length<[1, 2, 3]> // 3 * ``` */ export type Length<T extends UnknownArray> = T extends { length: infer L; } ? L : never;