Skip to content

In Range and Slider step props type should allow null with --strictNullChecks  #652

@tlehtimaki

Description

@tlehtimaki

The components src/Slider.tsx and src/Range.tsx define step prop as undefined or number. It should also include null as it is used in Range:

slider/src/Range.tsx

Lines 318 to 333 in b5a337e

getPoints() {
const { marks, step, min, max } = this.props;
const cache = this.internalPointsCache;
if (!cache || cache.marks !== marks || cache.step !== step) {
const pointsObject = { ...marks };
if (step !== null) {
for (let point = min; point <= max; point += step) {
pointsObject[point] = point;
}
}
const points = Object.keys(pointsObject).map(parseFloat);
points.sort((a, b) => a - b);
this.internalPointsCache = { marks, step, points };
}
return this.internalPointsCache.points;
}

So I would suggest changing the type for step prop to be step?: number | null

Related to changes that came in this pull request #641

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