Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "Function/Pipe"

Index

Type aliases

Pipe

Pipe<Fns, mode>: { 'sync': (...args: Parameters<Head<Fns>>) => Return<Fns[Tail<Fns>["length"]]>; 'async': (...args: Parameters<Head<Fns>>) => Promise<PromiseOf<Return<Fns[Tail<Fns>["length"]]>>>; }[mode]

Pipe Functions together

Type parameters

returns

Function

example

import {F} from 'ts-toolbelt'

/// If you are looking for creating types for `pipe`
/// `Piper` will check for input & `Piped` the output
declare function pipe<Fns extends F.Function[]>(...args: F.Piper<Fns>): F.Pipe<Fns>

const a = (a1: number) => `${a1}`
const b = (b1: string) => [b1]
const c = (c1: string[]) => [c1]

pipe(a, b, c)(42)

/// And if you are looking for an async `pipe` type
declare function pipe<Fns extends F.Function[]>(...args: F.Piper<Fns, 'async'>): F.Pipe<Fns, 'async'>

const a = async (a1: number) => `${a1}`
const b = async (b1: string) => [b1]
const c = async (c1: string[]) => [c1]

await pipe(a, b, c)(42)

PipeFnAsync

PipeFnAsync<Fns, K>: PipeFnAsync<Fns, K>

Type parameters

PipeFnSync

PipeFnSync<Fns, K>: PipeFnSync<Fns, K>

Type parameters

Piper

Piper<Fns, mode>: { 'sync': { [K in keyof Fns]: PipeFnSync<Fns, K>; }; 'async': { [K in keyof Fns]: PipeFnAsync<Fns, K>; }; }[mode]

Compute what the input of Pipe should be

Type parameters

example

Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.