Skip to content

How to type curried functions #10

@Harris-Miller

Description

@Harris-Miller

ramda's curry function is awesome but also has abilities that are not strictly necessary to type

// all of these work!
R.divide(10, 2); // 5
R.divide()(10, 2); // 5
R.divide(R.__)(10, 2); // 5

The use cases for both R.divide() and R.divide(R.__) are however negligible

So when typing out, we're only going to type it as:

export function divide(a: number, b: number): number;
export function divide(__: Placeholder, b: number): (a: number) => number;
export function divide(a: number): (b: number) => number;

And leave out

export function divide(): (a: number, b: number) => number;
export function divide(__: Placeholder): (a: number, b: number) => number;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions