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

propEq type doesn't account for optional properties

Open
#87 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the failing test mentioned in the issue and inspect the TypeScript definitions for the curried propEq entry point. Compare its behavior with the three-argument form and existing tests. Done means the optional-property example type-checks without regressing the existing propEq cases.

Written by the indexing model from the issue text.

Description

type DemoType = {
	optionalProp?: string
}

const filteredList = propEq('Yes', 'optionalProp')({ optionalProp: 'Yes' } as DemoType)

This produces this error:

Argument of type 'DemoType' is not assignable to parameter of type 'Record<"optionalProp", string>'. Types of property 'optionalProp' are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.

I feel like this should work just fine? The code runs as expected, just produces a the error.

it doesn't error if you pass all parameters at the same time rather than using the curried functions. I'm really not sure why.
propEq('Yes', 'optionalProp', { optionalProp: 'Yes' } as DemoType)

I've forked the project and written a failing test, but sadly I'm not proficient enough at typescript to write something that does any type guarding but allows my use case.

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.