Skip to content

fix: set options when constructing a Range from a Comparator - #910

Open
00200200 wants to merge 1 commit into
npm:mainfrom
00200200:fix/range-from-comparator-options
Open

00200200 wants to merge 1 commit into
npm:mainfrom
00200200:fix/range-from-comparator-options

Conversation

@00200200

Copy link
Copy Markdown

new Range(new Comparator(...)) returned before assigning this.options, so Range#test() threw TypeError: Cannot read properties of undefined (reading 'includePrerelease') for a prerelease version. satisfies(version, comparator) hits the same path.

Assign parsed options (and loose / includePrerelease) before that early return, matching the string-range constructor path.

Fixes #908

References

Fixes #908

The Comparator constructor branch returned before assigning
this.options, so Range#test threw when the version was a prerelease.
@00200200
00200200 requested a review from a team as a code owner September 29, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] new Range(comparator).test() throws TypeError for a prerelease version

1 participant