简中文档

prefer-namespace-keyword

NOTE: this rule is part of the 推荐 rule set.
Enable full set in deno.json:
{
  "lint": {
    "rules": {
      "tags": ["推荐"]
    }
  }
}
Enable full set using the Deno CLI:
deno lint --rules-tags=推荐
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the include or exclude array in deno.json:
{
  "lint": {
    "rules": {
      "include": ["prefer-namespace-keyword"],
      "exclude": ["prefer-namespace-keyword"]
    }
  }
}

建议在声明 TypeScript 模块时使用 namespace 关键字而不是 module 关键字。

TypeScript 支持 module 关键字用于组织代码,但这种表述可能会导致与 ECMAScript 模块的混淆。从 TypeScript v1.5 开始,它为我们提供了替代关键字 namespace,鼓励我们在编写 TypeScript 时始终使用 namespace。更多细节请参见 TypeScript v1.5 发布说明

无效:

module modA {}

declare module modB {}

有效:

namespace modA {}

// 允许使用 "ambient modules"
// https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
declare module "modB";
declare module "modC" {}

你找到了你需要的东西吗?

编辑此页面
隐私政策