• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Destructuring parameter declarations are not supported
2
3Rule ``arkts-no-destruct-params``
4
5**Severity: error**
6
7ArkTS requires parameters to be passed directly to the function, and
8local names to be assigned manually.
9
10
11## TypeScript
12
13
14```
15
16    function drawText({ text = "", location: [x, y] = [0, 0], bold = false }) {
17        console.log(text)
18        console.log(x)
19        console.log(y)
20        console.log(bold)
21    }
22
23    drawText({ text: "Hello, world!", location: [100, 50], bold: true })
24
25```
26
27## ArkTS
28
29
30```
31
32    function drawText(text: String, location: number[], bold: boolean) {
33        let x = location[0]
34        let y = location[1]
35        console.log(text)
36        console.log(x)
37        console.log(y)
38        console.log(bold)
39    }
40
41    function main() {
42        drawText("Hello, world!", [100, 50], true)
43    }
44
45```
46
47
48