• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Classes cannot be used as objects
2
3Rule ``arkts-no-classes-as-obj``
4
5**Severity: error**
6
7ArkTS does not support using classes as objects (assigning them to variables,
8etc.) because in ArkTS, a ``class`` declaration introduces a new type,
9not a value.
10
11
12## TypeScript
13
14
15```
16
17    class C {
18        s: string = ""
19        n: number = 0
20    }
21
22    let c = C
23
24```
25
26
27