xref: /arkcompiler/ets_frontend/ets2panda/linter/docs/rules/recipe128.md
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /arkcompiler/ets_frontend/ets2panda/linter/docs/rules/
13af6ab5fSopenharmony_ci#  Ambient module declaration is not supported
23af6ab5fSopenharmony_ci
33af6ab5fSopenharmony_ciRule ``arkts-no-ambient-decls``
43af6ab5fSopenharmony_ci
53af6ab5fSopenharmony_ci**Severity: error**
63af6ab5fSopenharmony_ci
73af6ab5fSopenharmony_ciArkTS does not support ambient module declaration because it has its
83af6ab5fSopenharmony_ciown mechanisms for interoperating with JavaScript.
93af6ab5fSopenharmony_ci
103af6ab5fSopenharmony_ci
113af6ab5fSopenharmony_ci## TypeScript
123af6ab5fSopenharmony_ci
133af6ab5fSopenharmony_ci
143af6ab5fSopenharmony_ci```
153af6ab5fSopenharmony_ci
163af6ab5fSopenharmony_ci    declare module "someModule" {
173af6ab5fSopenharmony_ci        export function normalize(s : string) : string;
183af6ab5fSopenharmony_ci    }
193af6ab5fSopenharmony_ci
203af6ab5fSopenharmony_ci```
213af6ab5fSopenharmony_ci
223af6ab5fSopenharmony_ci## ArkTS
233af6ab5fSopenharmony_ci
243af6ab5fSopenharmony_ci
253af6ab5fSopenharmony_ci```
263af6ab5fSopenharmony_ci
273af6ab5fSopenharmony_ci    // Import what you need from the original module
283af6ab5fSopenharmony_ci    import { normalize } from "someModule"
293af6ab5fSopenharmony_ci
303af6ab5fSopenharmony_ci```
313af6ab5fSopenharmony_ci
323af6ab5fSopenharmony_ci## See also
333af6ab5fSopenharmony_ci
343af6ab5fSopenharmony_ci- Recipe 129:  Wildcards in module names are not supported (``arkts-no-module-wildcards``)
353af6ab5fSopenharmony_ci
36

Indexes created Thu Nov 07 10:32:03 CST 2024