Skip to content

Commit

Permalink
Fix Packument['versions'] type.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Nov 6, 2023
1 parent 9e74056 commit a0b467e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/package-managers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export const mockViewMany =
},
version,
// overwritten below
versions: [],
versions: {},
...(isPackument(partialPackument) ? partialPackument : null),
}

Expand All @@ -315,7 +315,9 @@ export const mockViewMany =
} as Index<string>)
: ({
...packument,
versions: [packument],
versions: {
[version]: packument,
},
} as Packument),
})),
)
Expand Down
5 changes: 4 additions & 1 deletion src/types/Packument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Version } from './Version'

/** A pacote packument result object. */
export interface Packument {
_npmUser?: {
name: string
}
name: string
deprecated?: boolean
engines: {
Expand All @@ -12,5 +15,5 @@ export interface Packument {
// TODO: store only the time of the latest version?
time?: Index<string>
version: Version
versions: Packument[]
versions: Index<Packument>
}

0 comments on commit a0b467e

Please sign in to comment.