Param0
Get a function's first parameter
function MyComponent(props: Props) {
return <>...</>;
}import type { Param0 } from "tsafe";
type props = Param0<typeof MyComponent>;type props = Parameters<typeof MyComponent>[0];declare function fun(): number;
type FunParams = Param0<typeof fun>;
// ^void (instead of never)declare function fun(params?: { foo: string }): void;
type FunParams = Param0<typeof fun>;
// ^ { foo: string; } ( instead of { foo: string; } | undefined )Last updated
Was this helpful?