DefinitelyTyped / DefinitelyTyped/DefinitelyTyped

mapDispatchToProps wrongfully allows null

Open
#61,817 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
51.4k
Forks
30.4k
Avg merge
3d 21h
Merged PRs (30d)
108

Description

Hello,
I'm sorry if it's a known issue or a duplicate or something that is correct, I checked but couldn't find anyone mention that.

When I omit the mapDispatchToProps the typing is correct
image
image
But when I set the mapDispatchToProps explicitly to null
image
image
it breaks the omitted props (it's Omit<Props, never> instead of Omit<Props, 'storeProp'>)

Also if that is not an issue but a feature, could you explain why it works this way?

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Locate the mapDispatchToProps type definitions in this DefinitelyTyped repository and reproduce the difference between omitting the argument and passing null. Check how the resulting omitted props are inferred, then add coverage for both cases. Done means null no longer produces Omit<Props, never> when the omitted-props behavior should be preserved.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.