2

升级到 TypeScript .9 后,我的库模块别名不再起作用。

示例:
foo.d.tsfoo.ts(可以是扩展名)

declare module Foo {
    export class Bar {
    }
}

import Baz = Foo;

应用程序.ts

/// <reference path="foo.d.ts" />

var a = new Baz.Bar(); // Compiler error on Baz "Could not find symbol 'Baz'"
var b: Baz.Bar; // Works just fine, no compiler error
var c: Baz.Bar = new Baz.Bar(); // Compiler error on second Baz "Could not find symbol 'Baz'"
var d = new Foo.Bar(); // Works just fine

另请注意,它不必是“新 xyz”,它是对等号右侧 Baz 的任何引用。

现在,如果我将 foo.d.ts 中的代码放入app.ts 中,则不会引发编译器错误。我在想这是一个编译器问题,但我错过了什么吗?

更新:我为此创建了一个问题报告:http: //typescript.codeplex.com/workitem/1182

4

1 回答 1

0

这已在最新的 TypeScript 版本 0.9.1 http://blogs.msdn.com/b/typescript/archive/2013/06/28/announcing-typescript-0-9-0-1.aspx中修复

于 2013-06-29T02:25:51.247 回答