Skip to content

Typescript error for <Slider step={null} /> #26976

Closed
@ranbena

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Create <Slider> with prop step={null} and typescript yields an error that "null" is not an acceptable value.

What is expected?

That "null" value IS an acceptable value.
According to the docs it has a special meaning, and there's even an example in the AntD site with it - https://codesandbox.io/s/jxny9

What is actually happening?

In #26884 (v4.6.6) the ts definition was wrongly changed from step?: number | null to step?: number.

Environment Info
antd 4.6.6
React 16.13.1
System MacOS
Browser Chrome

🔔 Probably was undetected since the error appears for --strictnullchecks/strict: true in tsconfig.json.

Metadata

Assignees

No one assigned

    Labels

    help wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions