1# ArkCompiler Subsystem Changelog
2
3## cl.ArkCompiler.1 ArkTS Syntax Validator Change
4
5Compared with OpenHarmony SDK 4.0.10.8, the syntax validator in OpenHarmony SDK 4.0.10.10/11 is able to detect violations of the following rules and reports corresponding errors.
6
7> **NOTE**
8> This change is only an enhancement of the syntax validator capability. The syntax rules below are not new rules themselves.
9
10### Rule arkts-no-classes-as-obj
11
12This rule checks usage of an imported class as a variable. Below is an example:
13
14 ```ts
15// module1.ets
16export class C {}
17
18// module2.ets
19import { C } from './module1'
20
21let c = C  // error: arkts-no-class-as-obj
22 ```
23
24**Change Impact**
25
26Code adaptation is required. Otherwise, the compilation fails.
27
28**Key API/Component Changes**
29
30The ArkTS syntax validator is enhanced.
31
32**Adaptation Guide**
33
34Modify code files that do not comply with the ArkTS syntax rules. For details about the rules and modification suggestions, see [Adaptation Cases](../../../application-dev/quick-start/arkts-more-cases.md#arkts-no-classes-as-obj).
35
36### Rule arkts-strict-typing
37
38This rule checks assignment of values of the **X | undefined** type to an entity of the **X** type in the .ets file. Below is an example:
39
40 ```ts
41// module.ets
42function foo(a: number) {
43  return a + 1
44}
45
46function bar(x: number): number | undefined {
47  return x > 0 ? x : undefined
48}
49
50foo(bar(-123))  // error: arkts-strict-typing
51 ```
52
53This rule checks assignment of values of the **X | null** type to an entity of the **X** type in the .ets file. Below is an example:
54
55 ```ts
56// module.ets
57function foo(a: number) {
58  return a + 1
59}
60
61function bar(x: number): number | null {
62  return x > 0 ? x : null
63}
64
65foo(bar(-123))  // error: arkts-strict-typing
66 ```
67
68**Change Impact**
69
70Code adaptation is required. Otherwise, the compilation fails.
71
72**Key API/Component Changes**
73
74The ArkTS syntax validator is enhanced.
75
76**Adaptation Guide**
77
78Modify code files that do not comply with the ArkTS syntax rules. For details about the rules and modification suggestions, see [Adaptation Cases](../../../application-dev/quick-start/arkts-more-cases.md#arkts-strict-typingstrictmodeerror).
79
80### Rule arkts-no-ts-deps
81
82This rule checks imports of entities from an .ets file to a .ts file. Below is an example:
83
84
85 ```ts
86// lib.ts
87export class C {}
88
89
90// module.ets
91import { C } from './lib'
92 ```
93
94**Change Impact**
95
96Code adaptation is required. Otherwise, the compilation fails.
97
98**Key API/Component Changes**
99
100The ArkTS syntax validator is enhanced.
101
102**Adaptation Guide**
103
104Modify code files that do not comply with the ArkTS syntax rules. For details about the rules and modification suggestions, see [Adaptation Cases](../../../application-dev/quick-start/arkts-more-cases.md#arkts-no-tsdeps).
105
106## cl.ArkCompiler.2 ArkTS Syntax Rule Change
107
108Added ArkTS syntax rule levels: error and warning.
109
110- **Error**: constraint with which compliance is mandatory. An error will result in a compilation failure.
111- **Warning**: constraint with which compliance is recommended. A warning does not affect the compilation process, but may cause compilation failures in the future.
112
113Since 4.0.10.11, the levels of rules **arkts-no-definite-assignment** and **arkts-no-decorators-except-arkui** are degraded to warning. If **ESObject** is used in code, a warning is reported.
114
115In addition, the ArkTS syntax supports the following features:
116
117**tuple**, **keyof**, **for-of**, use of expansion characters in array scenarios, re-export, module name suffixed with .js, **readonly**, **Encode**, **Decode**, **ParesHexOctet**, **Array.isArray**, **Object.entries**, **Object.keys**, **Object.values**, **Object.hasOwn**, **Object.hasOwnPropertyNames**, **Reflect.get**, **Reflect.set**, **Reflect.has**, **Reflect.ownKeys**, **Reflect.set**, **Symbol.iterator**, and **Required** and **Readonly** in Utility types.
118
119**Change Impact**
120
121There is no compatibility impact. No code adaptation is required.
122