为模块定义 TypeScript 类型会给出 TS2665?

A T*_*A T 5 syntax typescript tsc tsd typescript1.8

尝试从旧迁移tsd.jsontypings.json. 以前我.d.ts有:

declare var modname: modname.modname;

declare module modname {
    export interface modname {
        new (): modname;
    }

    export interface foo {
        bar: string;
    }
}

declare module "mod-name" {
    export = modname;
}
Run Code Online (Sandbox Code Playgroud)

然后由于错误我将第一行更改为:

declare var modname: modname.modname;

declare namespace modname {
Run Code Online (Sandbox Code Playgroud)

但后来得到:

TS2665:模块扩充不能在顶级范围中引入新名称。

也许我应该以不同的方式安装打字?- 我注意到奇怪的脚手架被自动添加到我的定义文件中,这些文件安装有:

typings install github:user/typ/mod-name/mod-name.d.ts --save
Run Code Online (Sandbox Code Playgroud)

bas*_*rat -4

TS2665:模块扩充不能在顶级范围中引入新名称。

Master这在最新版本的打字稿中不再是一个错误npm install typescript@next

出于各种原因考虑使用此版本:https://basarat.gitbooks.io/typescript/content/docs/getting-started.html#nightly-typescript