• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Wildcards in module names are not supported
2
3Rule ``arkts-no-module-wildcards``
4
5**Severity: error**
6
7ArkTS does not support wildcards in module names because in the language
8import is a compile-time, not a runtime feature.
9Use ordinary export syntax instead.
10
11
12## TypeScript
13
14
15```
16
17    // Declaration:
18    declare module "*!text" {
19        const content: string
20        export default content
21    }
22
23    // Consuming code:
24    import fileContent from "some.txt!text"
25
26```
27
28## ArkTS
29
30
31```
32
33    // Declaration:
34    declare namespace N {
35        function foo(x: number): number
36    }
37
38    // Consuming code:
39    import * as m from "module"
40    console.log("N.foo called: ", N.foo(42))
41
42```
43
44## See also
45
46- Recipe 128:  Ambient module declaration is not supported (``arkts-no-ambient-decls``)
47- Recipe 130:  Universal module definitions (UMD) are not supported (``arkts-no-umd``)
48
49
50