Head<Type>
constructs a type which equals to first element in type Type
type FirstParameter<Type extends AnyFunction> = Head<Parameters<Type>>;
type StringValue = FirstParameter<typeof decodeURIComponent>;
// ^? string
- Returns
never
when typeType
is[]
or has0
length
TS Playground – https://tsplay.dev/Wo8gMw