Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 721 Bytes

curried.md

File metadata and controls

30 lines (21 loc) · 721 Bytes
category
Function

Curried

Currying function with support for dynamic parameters.

Usage

import type { Curried } from '@utype/core'

// Your implementation logic...
declare function yourCurrying<A extends unknown[], R>(fn: (...args: A) => R): Curried<A, R>

const yourFun = (a: string, b: number) => true;
const curriedYourFun = yourCurrying(yourFun);

// use your curried func
const res1 = curriedYourFun('123', 123);
const res2 = curriedYourFun('123')(123);

// Expect:
//  ((a: string, b: number) => boolean) &
//  ((a: string) => (b: number) => boolean)
type CurriedYourFun = typeof curriedYourFun;