UNPKG

1.56 kBTypeScriptView Raw
1import semver = require('../index');
2
3declare class SemVer {
4 constructor(version: string | SemVer, optionsOrLoose?: boolean | semver.Options);
5
6 raw: string;
7 loose: boolean;
8 options: semver.Options;
9 format(): string;
10 inspect(): string;
11
12 major: number;
13 minor: number;
14 patch: number;
15 version: string;
16 build: ReadonlyArray<string>;
17 prerelease: ReadonlyArray<string | number>;
18
19 /**
20 * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string).
21 *
22 * @return
23 * - `0` if `this` == `other`
24 * - `1` if `this` is greater
25 * - `-1` if `other` is greater.
26 */
27 compare(other: string | SemVer): 1 | 0 | -1;
28
29 /**
30 * Compares the release portion of two versions.
31 *
32 * @return
33 * - `0` if `this` == `other`
34 * - `1` if `this` is greater
35 * - `-1` if `other` is greater.
36 */
37 compareMain(other: string | SemVer): 1 | 0 | -1;
38
39 /**
40 * Compares the prerelease portion of two versions.
41 *
42 * @return
43 * - `0` if `this` == `other`
44 * - `1` if `this` is greater
45 * - `-1` if `other` is greater.
46 */
47 comparePre(other: string | SemVer): 1 | 0 | -1;
48
49 /**
50 * Compares the build identifier of two versions.
51 *
52 * @return
53 * - `0` if `this` == `other`
54 * - `1` if `this` is greater
55 * - `-1` if `other` is greater.
56 */
57 compareBuild(other: string | SemVer): 1 | 0 | -1;
58
59 inc(release: semver.ReleaseType, identifier?: string): SemVer;
60}
61
62export = SemVer;