UNPKG

1.73 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/// <amd-module name="@angular/compiler-cli/src/diagnostics/typescript_version" />
9/**
10 * Converts a `string` version into an array of numbers
11 * @example
12 * toNumbers('2.0.1'); // returns [2, 0, 1]
13 */
14export declare function toNumbers(value: string): number[];
15/**
16 * Compares two arrays of positive numbers with lexicographical order in mind.
17 *
18 * However - unlike lexicographical order - for arrays of different length we consider:
19 * [1, 2, 3] = [1, 2, 3, 0] instead of [1, 2, 3] < [1, 2, 3, 0]
20 *
21 * @param a The 'left hand' array in the comparison test
22 * @param b The 'right hand' in the comparison test
23 * @returns {-1|0|1} The comparison result: 1 if a is greater, -1 if b is greater, 0 is the two
24 * arrays are equals
25 */
26export declare function compareNumbers(a: number[], b: number[]): -1 | 0 | 1;
27/**
28 * Checks if a TypeScript version is:
29 * - greater or equal than the provided `low` version,
30 * - lower or equal than an optional `high` version.
31 *
32 * @param version The TypeScript version
33 * @param low The minimum version
34 * @param high The maximum version
35 */
36export declare function isVersionBetween(version: string, low: string, high?: string): boolean;
37/**
38 * Compares two versions
39 *
40 * @param v1 The 'left hand' version in the comparison test
41 * @param v2 The 'right hand' version in the comparison test
42 * @returns {-1|0|1} The comparison result: 1 if v1 is greater, -1 if v2 is greater, 0 is the two
43 * versions are equals
44 */
45export declare function compareVersions(v1: string, v2: string): -1 | 0 | 1;