[GH-ISSUE #1055] "Uncaught TypeError: Invalid Version: 10.*" unexpected after valid function returns success #2381

Closed
opened 2026-04-20 10:24:04 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @IdoWald-TomTom on GitHub (Nov 7, 2024).
Original GitHub issue: https://github.com/semver/semver/issues/1055

using "semver": "7.6.2" on Chrome.

The following code will throw an error:
`
import { lt, valid } from 'semver';

const version = "10.";
if (valid(version)){
return lt("1.0.0", version);
}
`
Will throw error:
"Uncaught TypeError: Invalid Version: 10.
"

Expected:
If the version pass the valid condition, then it should not throw an invalid error.

Originally created by @IdoWald-TomTom on GitHub (Nov 7, 2024). Original GitHub issue: https://github.com/semver/semver/issues/1055 using "semver": "7.6.2" on Chrome. The following code will throw an error: ` import { lt, valid } from 'semver'; const version = "10.*"; if (valid(version)){ return lt("1.0.0", version); } ` Will throw error: "Uncaught TypeError: Invalid Version: 10.*" Expected: If the version pass the valid condition, then it should not throw an invalid error.
Author
Owner

@IdoWald-TomTom commented on GitHub (Nov 7, 2024):

irrelevant

<!-- gh-comment-id:2461844867 --> @IdoWald-TomTom commented on GitHub (Nov 7, 2024): irrelevant
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#2381