typescript - 在 TypeScript 中重载签名必须全部是环境或非环境

标签 typescript overloading ambient

这是代码。

文件名是common.ts

module common{

        export function commonInit(){

            return true;
        }
}

当我构建 eclipse Ant 时,它变成了

"Error TS2384: Overload signatures must all be ambient or non-ambient.".

任何人都可以解释如何解决该错误。

最佳答案

你应该试试这个:

declare module Common{

        function commonInit(){

            return true;
        }
}
export var common:Common;

不能在模块内部导出。

关于typescript - 在 TypeScript 中重载签名必须全部是环境或非环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35979435/

相关文章:

typescript - 是否可以构建自定义内部类型?

class - typescript 0.9.1 CommonJS : correctly declaring exported ambient class implementing external interface?

javascript - 即使在将数字显式转换为字符串变量后,Angular 仍然编译没有错误

javascript - 如何在 Angular 10 中修补动态表单数组的值?

c++ - 转换运算符重载

C++ 错误 C2801 : 'operator =' must be a non-static member

c++ - 数值数组类 : Multiplication using friend functions

tridion - 如何在 Tridion CWA Web 应用程序中配置环境框架

html - 如何在 Angular 中自动滚动?