This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
/
test.ts.lint
42 lines (38 loc) · 2.27 KB
/
test.ts.lint
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
[typescript]: >= 3.2.0
type MyNumber = number;
type MyString = string;
type MyBigInt = bigint;
interface NumberStringBigint {
first: MyNumber,
second: MyString,
third: MyBigInt
}
var x = 5;
var y = "10";
var bigintVar = BigInt(200);
var anyVar: any = 200;
var pair: NumberStringBigint = {
first: 5, first: 5,
second: "10" second: "10",
third: BigInt(100),
};
const bigIntPassA = BigInt(1) + BigInt(2);
const bigIntPassB = BigInt(1) + 100n;
const bigIntFailA = BigInt(1) + 2;
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + 2]
const bigIntFailB = BigInt(1) + "failureString";
~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + "failureString". Consider using template literals.]
const bigIntFailC = bigintVar + x;
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + number]
const bigIntFailD = y + bigintVar;
~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found string + bigint. Consider using template literals.]
const bigIntFailE = bigintVar + anyVar;
~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + any]
const bigIntFailF = pair.first + pair.third;
~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found number + bigint]
const bigIntFailG = pair.third + pair.second;
~~~~~~~~~~~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + string. Consider using template literals.]
const bigIntFailH = bigintVar + [];
~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + []]
const bigIntFailI = bigintVar + {};
~~~~~~~~~~~~~~ [Operands of '+' operation must either be both strings or both numbers or both bigints, but found bigint + {}]