Skip to content

pipeCall

The pipeCall() function wraps a function so its first argument does not influence pipe inference. It is useful when a function is not generic on its first parameter and its type bubbles up the chain, breaking overall inference.

Interactive example

Syntax

typescript
function pipeCall<
	GenericInput extends unknown,
	GenericOutput extends unknown
>(
	theFunction: (input: NoInfer<GenericInput>) => GenericOutput
): (input: GenericInput) => NoInfer<GenericOutput>;

Parameters

  • theFunction : The function to use inside a pipe without forcing the input inference.

Return value

The same function, typed to preserve pipe inference.

See also

  • pipe - Composes synchronous functions
  • innerPipe - Reusable pipe version

Released under the MIT license.