Skip to content

Type of ValueType is incorrect - is string | number | null, should be string | number #481

Description

@fnimick

null was added to resolve ant-design/ant-design#37412 - however, the fix in #470 was incorrect. Having null as a valid value for all ValueType entries breaks compatibility with React.InputHTMLAttributes min, max, and step properties which explicitly exclude null. This is preventing this library from being used in projects with strict null checks enabled.

The correct solution here is to add null to the input value type of the onChange function, and nowhere else. It is explicitly called with null only in one special case as outlined in https://github.com/react-component/input-number/blob/master/src/InputNumber.tsx#L313

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions