react-component / react-component/input-number

Parser should allow to return null instead of a number

Open
#315 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
323
Forks
188
Avg merge
20h 3m
Merged PRs (30d)
1

Description

Typescript should allow the parser function to return null or undefined. Sometimes, we want to leave a number field empty and not default to 0.

See the example below:

https://codesandbox.io/s/inputnumber-antd-14150-forked-higgh?file=/index.tsx

Sidenote: <InputNumber<number | undefined> does not work because T extends valueTypes which is number | string

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

Start with the InputNumber type declarations and the parser function described in the issue, then reproduce the behavior in the linked CodeSandbox at index.tsx. Done means TypeScript accepts parser results of null or undefined for an empty number field without defaulting the value to 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.