Call signature of `take` can prevent type inferrence when using curried signature
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
- Domain
- developer-experience
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:
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ramda/types
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
`intersection` should return an array of the intersection of the types of each array's elementsOpen
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
prime-radiant-inc/evener#3726 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FuRongJun-1999/dsh-memory#56 ·
Maintainers usually reply within 1 day
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pingdotgg/t3code#15682 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openwatersio/slackwater.xyz#152 ·
Maintainers usually reply within 1 day
-
[BUG] 请修改标题为您遇到的问题Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenListTeam/OpenList-Worker#103 ·
Maintainers usually reply within 1 day