非导出的TypeScript声明DTS文件中带有枚举的模块?

时间:2019-02-27 22:16:10

标签: typescript typescript-typings

我遇到这样的情况,我需要将一个枚举重新显示为与各种导出值不同的属性。也就是说,它们都为.ONE使用了相同的基础枚举:

CanBeInCode.NumberEnum.ONE;
CanAlsoBeInCode.AnotherNumberEnum.ONE;

这基于以下DTS文件:

module ModuleNameShouldOnlyAppearInTypes {
  enum NumberEnum { ONE }

  interface TypeOnlyInterface {
    NumberEnum: typeof NumberEnum;
  }

  interface AnotherTypeOnlyInterface {
    AnotherNumberEnum: typeof NumberEnum;
  }
}

const CanBeInCode: ModuleNameShouldOnlyAppearInTypes.TypeOnlyInterface;
const CanAlsoBeInCode: ModuleNameShouldOnlyAppearInTypes.AnotherTypeOnlyInterface;

不幸的是,尽管我不希望以下内容自动完成:

ModuleNameShouldOnlyAppearInTypes.NumberEnum.ONE;

是否有办法将枚举移动到非导出模块中,而该模块只能由DTS文件中的其他模块引用,以使主枚举不会浮出水面?

0 个答案:

没有答案
相关问题