renovatebot/pep440

incorrect type of function parameters

Closed this issue ยท 4 comments

In the file lib/specifier.d.ts
The functions maxSatisfyingVesrion and minSatisfyingVersion, the parameter version have type string which needs to be of type string[] and renamed to versions.

There is another issue. The options parameter isn't Pep440Version type.

There is another issue. The options parameter isn't Pep440Version type.

It is used as an object with the property prereleases in it. And then it is merged in an object which is of type pep440Version. Unable to figure out a specific type with this much information.๐Ÿ˜Ÿ Any suggestions?

I think it should be a simple Options interface with only prereleases?:boolean

return explained && !(explained.is_prerelease && !options.prereleases);

pep440/lib/specifier.js

Lines 134 to 140 in 160be84

if (spec.prereleases === undefined) {
spec.prereleases = spec.is_prerelease;
}
if (explained && explained.is_prerelease && !spec.prereleases) {
return false;
}

It's used in local function contains but never get's outside of pick function

export interface Pep440SpecifierOptions {
  prereleases?: boolean;
}

Tested here:

const args = [versions, spec, { prereleases }];