• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Importing a module for side-effects only is not supported
2
3Rule ``arkts-no-side-effects-imports``
4
5**Severity: error**
6
7ArkTS does not support global variables like ``window`` to avoid
8side-effects during module importing. All variables marked as export can be
9accessed through the ``*`` syntax.
10
11
12## TypeScript
13
14
15```
16
17    // === module at "path/to/module.ts"
18    export const EXAMPLE_VALUE = 42
19
20    // Set a global variable
21    window.MY_GLOBAL_VAR = "Hello, world!"
22
23    // ==== using this module:
24    import "path/to/module"
25
26```
27
28## ArkTS
29
30
31```
32
33    import * as m from "path/to/module"
34
35```
36
37
38