看起来你不能再在TypeScript 0.9中这样做了:
declare module "mymodule" {
export function(): any;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法创建允许在0.9中调用导出模块的打字?
请注意,导出的函数没有名称.这是在以前版本的typescript中声明可调用模块的方法,因为有很多节点模块只导出一个函数.
这种变化似乎是刻意的,而且不再有办法做到这一点:
The ‘module’ keyword no longer creates a type
Description: In 0.9.0, a clearer distinction is made between roles of namespaces, types, and values. Modules now contribute only to namespaces and values and will no longer contribute a type.
Reason: This simplification of the role of modules allow modules to now extend classes and functions more easily.
Run Code Online (Sandbox Code Playgroud)
来自:http://blogs.msdn.com/b/typescript/archive/2013/04/22/announcing-0-9-early-previews.aspx