input-number icon indicating copy to clipboard operation
input-number copied to clipboard

Parser should allow to return null instead of a number

Open Mathieuu opened this issue 5 years ago • 2 comments

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

Mathieuu avatar Apr 09 '21 18:04 Mathieuu

add @ts-ignore to the parser function 😂 acturally onChange will return null instead undefined even if your parser function return undefined

hugo1o1 avatar Jul 29 '21 11:07 hugo1o1

Agree to this request. Good to know you can just ignore the TS error but would be good to have the TS reflect it.

mcshaman avatar Aug 08 '24 01:08 mcshaman