Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/tsafe/Param0.ts

🔩 The missing TypeScript utils
Go to Latest
File
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Parameters } from "./Parameters.ts";
type NonUndefined<T> = T extends undefined ? never : T;
/** Shorthand for Parameters<typeof f>[0] https://docs.tsafe.dev/param0 */export type Param0<T extends ((...args: any[]) => unknown) | null | undefined | false | ""> = [ Parameters<T>,] extends [never] ? never : Parameters<T> extends [] ? void : NonUndefined<Parameters<T>[0]>;