为什么从我的速记模块声明中导入的内容被识别为名称空间而不是“ any”?

时间:2019-02-12 17:00:36

标签: typescript

根据handbook(在“速记环境模块”下):

  

所有从速记模块导入的内容将具有任意类型。

但是,如果我尝试使用声明文件其余部分中模块中的任何内容,则会出现错误。

declare module "module1";
declare module "module2" {
    import * as deps from "module1"
    import { ValueType } from "module1"
    export type ComplexType = {
        value1: deps.ValueType, // ERROR: Namespace '"internal"' has no exported member 'ValueType'.
        value2: ValueType // ERROR: Cannot use namespace 'ValueType' as a type.
    }
}

这是预期的行为吗?这似乎与文档相反。

0 个答案:

没有答案