Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Call signature of `take` can prevent type inferrence when using curried signature

Open
#69 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Search the type declarations and tests for take and takeLast, then compare their curried signatures with the examples in the issue. Update the signatures so array element types are inferred through a pipe, and verify that the affected inference cases pass.

Written by the indexing model from the issue text.

Description

The current typing of the take function is this:

export function take(n: number): {
  (xs: string): string;
  <T>(xs: readonly T[]): T[];
};
export function take(n: number, xs: string): string;
export function take<T>(n: number, xs: readonly T[]): T[];

Right now, when you call the curried signature inside a pipe, the type of the array is not correctly inferred:

image You can see the type inference is working correctly without the `R.take` call: image

The solution is to change the curried signature for taking from an array to this:

export function take<T>(n:number): (xs: readonly T[]) => T[]

This also applies to takeLast.

I would be happy to open a PR for this.

Dominant language
TypeScript
Stars
31
Forks
27
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ramda/types

All issues in ramda/types

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.