• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  ``globalThis`` is not supported
2
3Rule ``arkts-no-globalthis``
4
5**Severity: error**
6
7ArkTS does not support both global scope and ``globalThis`` because untyped
8objects with dynamically changed layout are not supported.
9
10
11## TypeScript
12
13
14```
15
16    // in a global file:
17    var abc = 100
18
19    // Refers to 'abc' from above.
20    globalThis.abc = 200
21
22```
23
24## ArkTS
25
26
27```
28
29    // file1
30    export let abc : number = 0
31
32    // file2
33    import * as M from "file1"
34
35    M.abc = 200
36
37```
38
39## See also
40
41- Recipe 139:  Declaring properties on functions is not supported (``arkts-no-func-props``)
42- Recipe 144:  Usage of standard library is restricted (``arkts-limited-stdlib``)
43
44
45