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
Copy file name to clipboardexpand all lines: tests/baselines/reference/classImplementsPrimitive.errors.txt
+29-2
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,15 @@
1
1
classImplementsPrimitive.ts(3,20): error TS2864: A class cannot implement a primitive type like 'number'. It can only implement other named object types.
2
2
classImplementsPrimitive.ts(4,21): error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
3
3
classImplementsPrimitive.ts(5,21): error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
4
+
classImplementsPrimitive.ts(7,29): error TS2864: A class cannot implement a primitive type like 'number'. It can only implement other named object types.
5
+
classImplementsPrimitive.ts(8,29): error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
6
+
classImplementsPrimitive.ts(9,29): error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
7
+
classImplementsPrimitive.ts(11,31): error TS2864: A class cannot implement a primitive type like 'number'. It can only implement other named object types.
8
+
classImplementsPrimitive.ts(12,31): error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
9
+
classImplementsPrimitive.ts(13,31): error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
4
10
5
11
6
-
==== classImplementsPrimitive.ts (3 errors) ====
12
+
==== classImplementsPrimitive.ts (9 errors) ====
7
13
// classes cannot implement primitives
8
14
9
15
class C implements number { }
@@ -14,4 +20,25 @@ classImplementsPrimitive.ts(5,21): error TS2864: A class cannot implement a prim
14
20
!!! error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
15
21
class C3 implements boolean { }
16
22
~~~~~~~
17
-
!!! error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
23
+
!!! error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
24
+
25
+
const C4 = class implements number {}
26
+
~~~~~~
27
+
!!! error TS2864: A class cannot implement a primitive type like 'number'. It can only implement other named object types.
28
+
const C5 = class implements string {}
29
+
~~~~~~
30
+
!!! error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
31
+
const C6 = class implements boolean {}
32
+
~~~~~~~
33
+
!!! error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
34
+
35
+
const C7 = class A implements number { }
36
+
~~~~~~
37
+
!!! error TS2864: A class cannot implement a primitive type like 'number'. It can only implement other named object types.
38
+
const C8 = class B implements string { }
39
+
~~~~~~
40
+
!!! error TS2864: A class cannot implement a primitive type like 'string'. It can only implement other named object types.
41
+
const C9 = class C implements boolean { }
42
+
~~~~~~~
43
+
!!! error TS2864: A class cannot implement a primitive type like 'boolean'. It can only implement other named object types.
0 commit comments