1# ``as const`` assertions are not supported 2 3Rule ``arkts-no-as-const`` 4 5**Severity: error** 6 7ArkTS does not support ``as const`` assertions because in the standard TypeScript 8``as const`` annotates literals with corresponding literal types, and ArkTS 9does not support literal types. 10 11 12## TypeScript 13 14 15``` 16 17 // Type 'hello': 18 let x = "hello" as const 19 20 // Type 'readonly [10, 20]': 21 let y = [10, 20] as const 22 23 // Type '{ readonly text: "hello" }': 24 let z = { text: "hello" } as const 25 26``` 27 28## ArkTS 29 30 31``` 32 33 // Type 'string': 34 let x : string = "hello" 35 36 // Type 'number[]': 37 let y : number[] = [10, 20] 38 39 class Label { 40 text : string = "" 41 } 42 43 // Type 'Label': 44 let z : Label = { 45 text: "hello" 46 } 47 48``` 49 50 51