You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: test/rules/restrict-plus-operands/default/test.ts.lint
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -17,38 +17,38 @@ var pair: NumberStringPair = {
17
17
18
18
// bad
19
19
var bad1 = 5 + "10";
20
-
~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found 5 + "10". Consider using template literals.]
20
+
~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found 5 + "10". Consider using template literals.]
21
21
var bad2 = [] + 5;
22
-
~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found [] + 5]
22
+
~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found [] + 5]
23
23
var bad3 = [] + {};
24
-
~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found [] + {}]
24
+
~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found [] + {}]
25
25
var bad4 = [] + [];
26
-
~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found [] + []]
26
+
~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found [] + []]
27
27
var bad4 = 5 + [];
28
-
~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found 5 + []]
28
+
~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found 5 + []]
29
29
var bad5 = "5" + {};
30
-
~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found "5" + {}. Consider using template literals.]
30
+
~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found "5" + {}. Consider using template literals.]
31
31
var bad6 = 5.5 + "5";
32
-
~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found 5.5 + "5". Consider using template literals.]
32
+
~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found 5.5 + "5". Consider using template literals.]
33
33
var bad7 = "5.5" + 5;
34
-
~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found "5.5" + 5. Consider using template literals.]
34
+
~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found "5.5" + 5. Consider using template literals.]
35
35
var bad8 = x + y;
36
-
~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found number + string. Consider using template literals.]
36
+
~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found number + string. Consider using template literals.]
37
37
var bad9 = y + x;
38
-
~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found string + number. Consider using template literals.]
38
+
~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found string + number. Consider using template literals.]
39
39
var bad10 = x + {};
40
-
~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found number + {}]
40
+
~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found number + {}]
41
41
var bad11 = [] + y;
42
-
~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found [] + string. Consider using template literals.]
42
+
~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found [] + string. Consider using template literals.]
43
43
var bad12 = pair.first + "10";
44
-
~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found number + "10". Consider using template literals.]
44
+
~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found number + "10". Consider using template literals.]
45
45
var bad13 = 5 + pair.second;
46
-
~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found 5 + string. Consider using template literals.]
46
+
~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found 5 + string. Consider using template literals.]
47
47
var bad14 = pair + pair;
48
-
~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found NumberStringPair + NumberStringPair]
48
+
~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found NumberStringPair + NumberStringPair]
49
49
var anyTyped: any = 5;
50
50
var bad15 = anyTyped + 12;
51
-
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers, but found any + 12]
51
+
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found any + 12]
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + 2]
25
+
const bigIntFailB = BigInt(1) + "failureString";
26
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + "failureString". Consider using template literals.]
27
+
28
+
const bigIntFailC = bigintVar + x;
29
+
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + number]
30
+
const bigIntFailD = y + bigintVar;
31
+
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found string + bigint. Consider using template literals.]
32
+
const bigIntFailE = bigintVar + anyVar;
33
+
~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + any]
34
+
35
+
const bigIntFailF = pair.first + pair.third;
36
+
~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found number + bigint]
37
+
const bigIntFailG = pair.third + pair.second;
38
+
~~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + string. Consider using template literals.]
39
+
const bigIntFailH = bigintVar + [];
40
+
~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + []]
41
+
const bigIntFailI = bigintVar + {};
42
+
~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + {}]
0 commit comments