• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Class literals are not supported
2
3Rule ``arkts-no-class-literals``
4
5**Severity: error**
6
7ArkTS does not support class literals. Introduce new named class types
8explicitly.
9
10
11## TypeScript
12
13
14```
15
16    const Rectangle = class {
17        constructor(height: number, width: number) {
18            this.height = height
19            this.width = width
20        }
21
22        height
23        width
24    }
25
26    const rectangle = new Rectangle(0.0, 0.0)
27
28```
29
30## ArkTS
31
32
33```
34
35    class Rectangle {
36        constructor(height: number, width: number) {
37            this.height = height
38            this.width = width
39        }
40
41        height: number
42        width: number
43    }
44
45    const rectangle = new Rectangle(0.0, 0.0)
46
47```
48
49
50