-
Notifications
You must be signed in to change notification settings - Fork 0
/
semver.d.ts
64 lines (62 loc) · 2.04 KB
/
semver.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
declare module 'semver' {
export function parse(version: string): SemVer | null;
export function clean(version: string, options?: Options): string | null;
export function valid(version: string): string | null;
export function inc(
version: string,
release: ReleaseType,
optionsOrNum?: Options | number,
identifier?: string,
): string | null;
export function compare(v1: string, v2: string, loose?: boolean): -1 | 0 | 1;
export function rcompare(v1: string, v2: string, loose?: boolean): -1 | 0 | 1;
export function major(version: string): number;
export function minor(version: string): number;
export function patch(version: string): number;
export function prerelease(version: string, options?: Options): (string | number)[];
export function intersects(
range1: string | SemVer,
range2: string | SemVer,
options?: Options,
): boolean;
export function simplifyRange(range: string | SemVer, options?: Options): string;
export function gtr(version: string | SemVer, range: string | SemVer, options?: Options): boolean;
export function ltr(version: string | SemVer, range: string | SemVer, options?: Options): boolean;
export function outside(
version: string | SemVer,
range: string | SemVer,
hilo?: '>' | '<',
options?: Options,
): boolean;
export function satisfies(
version: string | SemVer,
range: string | SemVer,
options?: Options,
): boolean;
export class SemVer {
public major: number;
public minor: number;
public patch: number;
public prerelease: (string | number)[];
public build: string[];
constructor(version: string, optionsOrLoose?: boolean | Options);
public format(): string;
public inspect(): string;
public toString(): string;
}
export type ReleaseType =
| 'major'
| 'premajor'
| 'minor'
| 'preminor'
| 'patch'
| 'prepatch'
| 'prerelease';
export interface Options {
loose?: boolean;
includePrerelease?: boolean;
rangeRequired?: boolean;
coerce?: boolean;
rtl?: boolean;
}
}